Install Office 365 Powershell modules
![](https://www.tbone.se/wp-content/uploads/2020/02/logo-powershell.png)
I was about to test the new Exchange online V2 Powershell module and discovered that none of the powershell modules for Office 365 was installed. I have recently reinstalled my machine and have not connected powershell sice. Thereby I started to search for all new modules to install. And why not share this with all.
![](https://www.tbone.se/wp-content/uploads/2020/02/Exchange-Server-Logo.jpg)
Most of the current modules is available in online repository. thereby no download of msi file and installation. You only run install-module command with the name of the module. These are the modules I found that are in scope of Office 365:
Install-Module -Name MsOnline
Install-Module -Name AzureAD
Install-Module -Name MicrosoftTeams
Install-Module -Name ExchangeOnlineManagement
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell
Install-Module -Name WhiteboardAdmin
Why not take the installation a bit further. If a module already is installed, I want to be able to upgrade the module. For this you use the update-module command. Lets build an array with all modules and loop through. check if each module is installed and update if true:
$modules = @(“MsOnline”,”AzureAD”,”MicrosoftTeams”,”ExchangeOnlineManagement”,”Microsoft.Online.SharePoint.PowerShell”,”Microsoft.PowerApps.PowerShell”,”WhiteboardAdmin”)
foreach($module in $modules){if(Get-Module -ListAvailable -Name $module) {update-module -name $module -force} else {install-module -name $module -skippublishercheck -force}}
Finally I ended up making a one liner to run each time i want to install or update all the modules on a computer:
@(“MsOnline”,”AzureAD”,”MicrosoftTeams”,”ExchangeOnlineManagement”,”Microsoft.Online.SharePoint.PowerShell”,”Microsoft.PowerApps.PowerShell”,”WhiteboardAdmin”)|% $_{if(Get-Module -ListAvailable -Name $_) {update-module -name $_ -force} else {install-module -name $_ -skippublishercheck -force}}