Single PowerShell Script to Install Multiple M365 Modules

This PowerShell blog post will show you a single PowerShell script to install multiple M365 modules.

PowerShell management for Microsoft 365 offers a versatile toolkit for administrators seeking to streamline their workflow and automate routine tasks across the Microsoft 365 suite.

By utilizing PowerShell, administrators can efficiently manage their organization’s user accounts, licenses, and services, all from a single command-line interface.

This powerful tool enables the execution of bulk operations, such as modifying user properties or assigning licenses, which can be particularly useful in large enterprises.

About the Script

By default, the script installs the following PowerShell module (on Windows, macOS and Linux):

  • ExchangeOnlineManagement
  • SharePointPnPPowerShellOnline
  • Azure
  • MicrosoftTeams
  • Microsoft.Graph

You can easily add more PowerShell modules to the list, add them to the list and run the script.

The script also includes exception handling in case there is an error.

Single PowerShell Script to Install Multiple M365 Modules

The script does the following: uninstall, install, import and check if the module has been loaded to the PowerShell session. The script has been tested on macOS and Windows.

If you have recommendations to improve the code, comment on this post.

1 thought on “Single PowerShell Script to Install Multiple M365 Modules”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.