How To Install the MSOnline PowerShell Module
In recent months, Microsoft has changed the distribution method for the MSOnline PowerShell Modules from the use of the .msi self-contained download to exclusively having it installed from the Online Gallery via the Install-Module cmdlets. Unfortunately, not every Windows-based operating system that you might be working from has the latest and greatest version of PowerShell, let alone an even fairly up-to-date version and you may find yourself in a situation where you cannot run Install-Module. The purpose of this article is to help you get going quickly using PowerShellGet/Install-Module Cmdlets on operating system that does not already have it available.
In order to install any module though the user of the Install-Module cmdlet you must be running an Operating System that supports PowerShell Version 3.0 or Greater (Windows 7, Windows Server 2008 R2 and later releases of Windows and Windows Server). Depending on the age of your Operating System build, even if it does lie within those parameters, it may not currently have PowerShell Version 3.0+ installed. To check which version of PowerShell you are currently running, open PowerShell and run:
$PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 5 1 17134 137
The 'Major' is really the primary focus, if it does not say "3" or greater, the Install-Module cmdlets are not available but they can be 'downloaded' or 'installed' through the Windows Management Framework package(s):
Windows Management Framework 3.0 Windows Management Framework 4.0 Windows Management Framework 5.1
Once with Windows Management Framework has been installed, all you simply need to do is open a new PowerShell window and execute Install-Module MSOnline, Install-Module AzureAD or any other module that is available through the PowerShell Gallery and you'll be on your way.