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
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.
In order to resolve this problem,
- Download Windows Management Framework 5.1.
- Choose Win8.1AndW2K12R2 version and Install
- Setup requires you to restart server