Book Image

PowerShell for Office 365

By : Martin Machado
Book Image

PowerShell for Office 365

By: Martin Machado

Overview of this book

While most common administrative tasks are available via the Office 365 admin center, many IT professionals are unaware of the real power that is available to them below the surface. This book aims to educate readers on how learning PowerShell for Offi ce 365 can simplify repetitive and complex administrative tasks, and enable greater control than is available on the surface. The book starts by teaching readers how to access Offi ce 365 through PowerShell and then explains the PowerShell fundamentals required for automating Offi ce 365 tasks. You will then walk through common administrative cmdlets to manage accounts, licensing, and other scenarios such as automating the importing of multiple users,assigning licenses in Office 365, distribution groups, passwords, and so on. Using practical examples, you will learn to enhance your current functionality by working with Exchange Online, and SharePoint Online using PowerShell. Finally, the book will help you effectively manage complex and repetitive tasks (such as license and account management) and build productive reports. By the end of the book, you will have automated major repetitive tasks in Office 365 using PowerShell.
Table of Contents (16 chapters)
Title Page
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

How to get help with PowerShell


PowerShell comes with a lot of in-built cmdlets, and with the addition of every new module, the list of available cmdlets increases. You can use your favorite search engine to get more information on a cmdlet. You can do this from the PowerShell window as well. The cmdlet to get the help is this:

Get-Help nameofcmdlet

Here's an, for example:

Get-Help Get-Service

The following screenshot shows the output for the preceding command:

This is useful if we would like to get help but don't want to leave the Command Prompt.

If you would like to get help from the official online documentation, you can use the following cmdlet:

Get-Help Get-Service -online

This will open the online help manual of the cmdlet with your default browser:

If you would like to quickly check whether there are any commands available for a particular service, you can use the following cmdlet:

Get-Command *Service*

This will give all the commands that contain the Service service in all the modules that are loaded:

What is a module?

A module is a combination of multiple PowerShell functionalities like scripts, cmdlets that are built to solve a common purpose. For example, to work with the users and licensing, we have to use the Module MSOnline provided by the Microsoft. You can find more information about the Windows PowerShell module here https://msdn.microsoft.com/en-us/library/dd878324(v=vs.85).aspx.

To find out the members of a cmdlet, we can pipe the Get-Member cmdlet with another cmdlet:

Get-Service | Get-Member

The following screenshot shows the output for the preceding command:

What is a pipe?

Using the pipe character (|), we can select the objects and then perform an action on them.

These three cmdlets--Get-Command, Get-Help, and Get-Member--are important to understand and use, especially when you are new to PowerShell. If you take a closer look, you will find the highlighted letters spell Microsoft compiled HTML help (.chm) files, which were the old-school help files available in Windows. We will use them throughout the book to get additional information on the commands we will use.