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.

PowerShell Scripts for Office 365

More info: Michel’s blog | Download

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.

PowerShell Scripts for Office 365

More info: TechNet Gallery | GitHub

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.

PowerShell Scripts for Office 365

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.

PowerShell Scripts for Office 365

More info: Chris’ blog | TechNet Gallery

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.

[adrotate banner=”50″]

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for


  1. Mukhesh

    Can we have a Power Shell script to fetch the O365 License details along with Users License Location?

  2. Manish Gupta

    Hi, Great post!!!

    Well, I was also, looking for a PowerShell script to export Office 365 mailbox to PST. I found several scripts but all they have written was not of any use.

    Hope, you will help me!!


    I need to create audit log report for office365. do you have script to do this

  4. Ben

    Wow, what a Christmas gift!!! Thanks Paul. Have a productive year ahead.

  5. Tore Melberg

    Excelent collection, Thanks for summing this up.

  6. Jeremy B

    Very nice collection of goodies. Thanks!

Leave a Reply