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

Common administrative cmdlets that are used for managing accounts and licensing


Office 365 is a subscription-based service, and it is important for organizations to manage the licenses of users, such as assigning a license to a new user, removing licenses, and activating new licenses in bulk.

Before assigning the license, let's see how we can filter users based on some criteria. For example, if you have users in multiple locations, we can use the following cmdlets to filter users based on the location Bethesda:

  1. Since PowerShell for Office 365 is used via remote management, as always the first step will be to connect to Office 365 and prove our identity:
        Import-Module MSOnline
        $cred = Get-Credential

This will launch the Windows PowerShell credential request dialog.

  1. Enter a valid Office 365 work or school User name and Password and click on OK:
  1. Now run the cmdlet:
        Connect-MsolService -Credential $cred

If the cmdlet is successful, it will not display an error message. This should...