Microsoft 365 PowerShell Modules
Microsoft 365 PowerShell Modules is an umbrella term for a range of PowerShell modules that can be used for administering Microsoft/Office 365 services such as Exchange Online, Teams or SharePoint Online.
What are Microsoft 365 PowerShell Modules?
With the symbioses of the Microsoft 365 (formerly „Office 365“) services and the powerful automation capabilities of Windows PowerShell, almost all needs of autonomous administrative nature can be satisfied. Microsoft 365 PowerShell Modules complement and extend the Microsoft 365 admin center and offer the possibility to automate most of the tasks that can be done there manually.
Essentially, the Microsoft 365 PowerShell modules are a bundle of modules for PowerShell, containing Cmdlets for the administration and automation of Microsoft 365 services.
They are handy for getting access to information that can’t be easily investigated from the Microsoft 365 admin center, or to automate managing processes of Microsoft 365 services. The following list gives a short overview of the Microsoft 365 PowerShell Modules and their respective use cases.
Azure Active Directory Module
The Azure Active Directory Module can be used for managing groups, users and roles in Azure Active Directory.
Tip: If you’re new to Azure Administration, you might also want to take a look at our free webinar Azure Administration made easy.
SharePoint Online Management Shell
The SharePoint Online Module can be used for managing geo administrators, tenants, sites and users in SharePoint Online.
Head over to the ScriptRunner GitHub repo for a variety of ready-to-use PowerShell Scripts for these use cases: ActionPack for SharePoint Online
Exchange Online PowerShell V2 (EXO V2) Module
The Exchange Online PowerShell V2 Module can be used for managing distribution groups, mailboxes, resources and services with Exchange Online.
Head over to the ScriptRunner GitHub repo for a variety of ready-to-use PowerShell Scripts for these use cases: ActionPack for Exchange Online
Microsoft Teams PowerShell Module
The Microsoft Teams PowerShell Module can be used for managing general guidelines, the creation of channels and memberships, as well as for sending messages to channels and more.
Head over to the ScriptRunner GitHub repo for a variety of ready-to-use PowerShell Scripts for these use cases: ActionPack for Microsoft Teams
Tip: Our free webinar on Managing Microsoft Teams with PowerShell to save time is a good starting point if you want to learn how to administer Microsoft Teams with PowerShell.
Power Apps Administration PowerShell Module
The Power Apps Administration PowerShell Module enables you to automate many of the monitoring, management, and quality assurance tasks that are only possible manually today in Power Apps or the Power Apps Admin center.
Head over to the ScriptRunner GitHub repo for a variety of ready-to-use PowerShell Scripts for these use cases: ActionPack for Microsoft Power Apps/Flow.
Tip: Our free webinar on Administrating Power Apps and Automate (aka Flow) efficiently with PowerShell provides an overview of the current capabilities of the PowerShell module for Power Apps and shows you how to implement typical use cases.
Skype for Business Online PowerShell Module
The Skype for Business Online PowerShell Module can be used for managing members, resources, tenants, policies, settings, teams as well as networking between tenants. Head over to the ScriptRunner GitHub repo for a variety of ready-to-use PowerShell Scripts for these use cases.
Why manage Microsoft 365 with PowerShell?
The main 3 advantages to managing Microsoft 365 with PowerShell are the following:
- Opportunity to change all settings of Microsoft 365 services
Not all settings of Teams, Exchange Online, Azure, SharePoint and other services are accessible through their graphical user interfaces, some parameters can only be altered through PowerShell. - Automatic provisioning of users
ADSync as a Microsoft 365 Identity Management organizes users and groups in the AzureAD, but it only transfers information of the local active directory. With Exchange in hybrid mode ADSync is presupposed but the settings for POP3/IMAP, Quotas, ActiveSync Quarantine still have to be changed in the cloud. - Time-savings due to automation
Albeit some settings can be changed in the interfaces of the services themselves, once the initial hurdle of setting up all modules and scripts is overcome, a lot of actions are cut down by execution time and can be run from anywhere at any time, even without human supervision.
Microsoft 365 PowerShell commands
As a general recommendation: to receive a full list of all available Microsoft 365 PoSh cmdlets, execute the Get-Command with the listed parameter of the Microsoft 365 service you search help for (e.g. Get-Command -module AzureAD).
There are a lot of commands out there for every Microsoft 365 service listed earlier. To keep it simple, we listed all general commands in the next section.
Worth noting: all the following actions imply an already established connection with your Microsoft 365 tenant and the use of the Microsoft Azure Active Directory Module for Windows PowerShell!
Managing users in Microsoft 365 PowerShell
- List of all users and licenses
In order to list all available Microsoft 365 users and licenses, run Get-MsolUser. - Creating a User to Azure Active Directory
In order to create a new user to Azure AD, run New-MsolUser - Removing a User to Azure Active Directory
In order to remove a user to Azure AD, run Remove-MsolUser - Restore a deleted user account
Restoring an account works quite similar, but mind that it has to be done within the 30-day grace period, via running Restore-MsolUser - (Re-)Setting a password for a user
In order to set or reset the password for a user, run Set-MsolUserPassword - Updating or setting a user’s principal name
A user principal name (UPN, user ID) can be updated or set for the first time by running Set-MsolUserPrincipalName
Managing Licenses and services of Microsoft 365 subscriptions
- View licenses
I order to view all the SKUs for your company, run Get-MsolAccountSku - Assign and remove licenses to/from users
A license can be assigned to as well as removed from a specific user by running Set-MsolUserLicense
Webinar: Automation and delegation of Exchange/O365 administrative tasks with PowerShell
The ScriptRunner webinar library offers a variety of free content about administration and automation with PowerShell. For example, on the administration of Exchange/O365.