Install-Module is not recognized as the name of a cmdlet, function, script file, or operable program

By default, Install-Module cmdlet is not recognized on Windows 2012 R2 server. When running Install-Module on PowerShell, you will receive an error saying

Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ Install-Module AzureAD
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

InstallModule

The reason for this error is that you are running older version of Powershell on your server. You need to update to 5 or greater. You can identify PowerShell version on the server by running $PSVersionTable.PSVersion command.

PowerShell_Version

HostGator $2.75 per month
HostGator
24/7/365 Technical Support, Free Site Building Tools, 4500 Website Templates, Free Shopping Cart Software, Ideal for WordPress, 45 Day Money Back Guarantee

In order to resolve this problem,

  1. Download Windows Management Framework 5.1.
  2. Choose Win8.1AndW2K12R2 version and Install
  3. Setup requires you to restart server

 

InstallModule Patch PowerShell Upgrade