As Office 365 admins we have the opportunity to use PowerShell for a wide variety of administration tasks. PowerShell scripts make it possible to automate complex and routine tasks, which saves time and reduces operator error.
You can find a lot of PowerShell scripts online that MVPs and others in the Office 365 community have developed and shared. In this article, I'll share a selection of Office 365 PowerShell scripts that I think are useful for all of us.
Where to Start with PowerShell
If you're new to PowerShell then you might find it difficult to make use of these scripts without a little help. Most of them are user friendly and quite straightforward to use, but if you run into any problems you can leave a comment on the script creator's blog or TechNet Gallery submission for help. Everyone wants their scripts to be useful, so they're usually quick to respond.
If you're looking for PowerShell learning resources, here are my recommendations:
Office 365 Connection Script
MVP Michel de Rooij has developed this Office 365 connection script that contains functions for connecting to individual Office 365 services such as Exchange Online, Azure AD, Skype, Teams, and more. Be sure to read Michel's instructions on how to add the script to your PowerShell profile so that the functions are always available when you start a new PowerShell console.
Azure AD Connect Sync Report
This script by MVP Michael “Van Hybrid” Van Horenbeeck will generate a report for your Azure AD Connect server, showing you some useful system information as well as the recent sync history. Note, there is a dependency on the SQL Server PowerShell module for this script to work. You will either need the SQLPS or SQLServer module installed on your server. The script checks for the presence of the SQLPS module, so check the GitHub repo for a fix if you run into issues.
License Reconciliation Report
This script by MVP Alan Byrne from Cogmotive will generate a CSV file containing the license assignment information for your user accounts. This is useful for managing licensing costs for your organization.
More info: TechNet Gallery
AZCopy GUI for PST Imports
This script by MVP Chris Goosen adds a GUI for the AzCopy tool to make PST migrations using the Office 365 Import Service easier to deal with.
Other PowerShell Scripts for Office 365
In addition to those contributions from others, here's a list of my own PowerShell scripts that work with Office 365.
- Saving Credentials for Office 365 PowerShell Scripts and Tasks
- Office 365 Message Center Email Digest
- Office 365 Admin Role Group Members Report
- Generate Reports for New, Changed, and Deleted Office 365 Groups
- Bulk Add SMTP Addresses to Exchange Online Mailboxes
- Test Federated Domain Proof TXT Record for Hybrid Deployments
- Deploy the Microsoft Teams Client
- Deploy Office 365 ProPlus from a Network Share