All About the Office 365 for IT Pros GitHub Repository
A Store of PowerShell Scripts for Microsoft 365 Tenant Management in the Office365ITPros GitHub Repository
I’m on record as saying that knowing how to access and interact with Microsoft 365 data with PowerShell is essential knowledge for tenant administrators. Many options are enabled through settings that are only accessible through PowerShell, and it’s possible to extract more data from workloads with PowerShell (including use of Graph API requests) than is exposed through the different Microsoft 365 administrative interfaces.
Microsoft helps by including PowerShell examples in its documentation. The examples are basic and tend to concentrate on performing a single step in what is often a more complex sequence of commands necessary to fully complete a task. Nevertheless, all examples are welcome, and the Microsoft examples receive lots of attention because of their source.
What’s in the Office365ITPros Repository
As part of investigating Microsoft 365 technology to report how things work, we write a lot of PowerShell code. Until 2019, we published code in articles. At an Experts Live event in Oslo, Norway in 2019, Ståle Hansen (who wrote the Teams devices chapter for the book at that time) suggested that we establish a GitHub repository and use it to distribute script samples instead. Simple web links allow us to reference scripts in the Office365ITPros GitHub repository as needed in presentations, articles, and the Office 365 for IT Pros and Automating Microsoft 365 with PowerShell eBooks.
The suggestion made a ton of sense. Instead of updating script code in WordPress pages, we could update the script code in GitHub to keep it current, eliminate annoying bugs, and smoothen out problems caused by Microsoft changing the way that cmdlets work. For instance, scripts that call the Search-UnifiedAuditLog cmdlet have needed updates several times since 2018. Looking forward into 2025, Microsoft proposes to make another fundamental (and horrible) change to Search-UnifiedAuditLog that will cause many problems.
Another important change happened when the Microsoft Graph PowerShell SDK went from V1 to V2 and changed the structure of the modules and naming scheme for the beta cmdlets. Looking back, this was a good change, even if it caused disruption at the time by forcing developers to remove the cmdlet that selected beta or production cmdlets together with renaming any beta cmdlets called in scripts.
https://office365itpros.com/2021/01/21/introducing-office-365-for-it-pros-github-repository/The Office 365 for IT Pros GitHub repository (Figure 1) currently contains 304 PowerShell scripts covering different aspects of Microsoft 365 and Entra ID tenant management (the repository held 80 scripts when we first launched it in 2021). We update scripts when we discover issues or when people let us know about bugs or features they would like to see implemented.

The quality of the code has gradually improved over the years. Several reasons exist why this should be so:
- Writing complete scripts rather than snippets forces more attention to elements like error handling and report generation.
- The influence of GitHub Copilot. Everyone involved with Microsoft 365 PowerShell should use GitHub Copilot, especially now that Microsoft offers a free version of GitHub Copilot for Visual Studio Code.
- Learning from other people, including Michel de Rooij’s Practical PowerShell series.
The repository could be better organized into folders for different topics and the naming convention isn’t great at times. We know that things could be better and improving the structure is on our to-do list.
It’s important to understand that Office 365 for IT Pros does not create fully-fledged solutions. The scripts are to explore principles of interacting with Microsoft 365 workloads, to extract and refine data, create objects, manage settings, and so on. Error handling is enough to make sure that everything works, but not sufficient for deployment in a production environment. We take this approach deliberately because every organization has its own coding standards. Our intention is that developers can take the code we create and meld it in their own fashion to solve automation problems within a tenant.
Forking the Office365ITPros GitHub Repository
You can share the scripts in the Office365ITPros repository by forking to create your own copy of the repository. As you can see from Figure 1, 583 forks exist for the Office365ITPros repository, all created by people who want to have their own copy of the scripts to work with. Those with forks can change code to make scripts work better by fixing bugs or adding features and then push the changes for inclusion in our repository. Twenty people have made contributions in this manner since the creation of the repository. It’s a great example of community in action.
Browse the Office365ITPros GitHub Repository – And Maybe Become a Contributor
The Office365ITPros repository exists to share PowerShell code so that we can all learn how to write quality scripts for Microsoft 365. Take the time to browse the scripts to see what might be useful to you. If you find something that could be done better, fork the repository and make the change and push the amended code to us. We’ll have a look at the changes and decide whether to accept them. We always welcome a new contributor!
Need more help to write and manage PowerShell scripts for Microsoft 365? Get a copy of the Automating Microsoft 365 with PowerShell eBook, available standalone or as part of the Office 365 for IT Pros eBook bundle.