Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
24.3k views
in PowerShell by 6 6 9
edited by

I got this error The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. when I tried to install Microsoft.Online.SharePoint.PowerShell module

PS C:\Users\system32> Install-Module -Name Microsoft.Online.SharePoint.PowerShell
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 -Name Microsoft.Online.SharePoint.PowerShell
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The term 'Install-Module' is not recognized as the name of a cmdlet

Why The term 'Install-Module' is not recognized in Windows Server 2012? How I can solve this problem?


1 Answer

1 like 0 dislike
by 151 169 345
selected by
 
Best answer

The term 'Install-Module' is not recognized as the name of a cmdlet

The term 'Install-Module' is not recognized usually occurs if you are using a PowerShell version older than PowerShell 5.0.

Note: Install-Module runs on PowerShell 5.0 or later releases.


How to get the current PowerShell Version?

To get the current PowerShell Version, you should run one of the below cmdlets:

host

get Powershell host Version

$psversiontable

get Powershell Version

As above-shown, the PowerShell version is 4.0 that doesn't support the Install-Module cmdlet.


Solving The term 'Install-Module' is not recognized as the name of a cmdlet

To solve The term 'Install-Module' is not recognized as the name of a cmdlet, you need to download and install Windows Management Framework 5.1 which includes Windows PowerShell 5.1.

What's Windows Management Framework 5.1?

Windows Management Framework 5.1 includes updates to Windows PowerShell, Windows PowerShell Desired State Configuration (DSC), Windows Remote Management (WinRM), Windows Management Instrumentation (WMI).

Supported Operating System

Windows 7 Service Pack 1, Windows 8.1, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

  • Windows Server 2012 R2
  • Windows Server 2012
  • Windows Server 2008 R2 SP1
  • Windows 8.1
  • Windows 7 SP1

Note: Windows Management Framework 5.1 requires Microsoft .NET Framework 4.5 or above.

Download Windows Management Framework 5.1

  • Download Windows Management Framework 5.1.
  • Select the corresponding version based on your operating system.
    download Windows Management Framework 5.1
  • In Windows Server 2012 R2, double click on the downloaded file to install Windows Management Framework 5.1 > Click on "Yes".
    install Windows Management Framework 5.1
    Windows update standalone Installer
  • Click on I Accept button to continue.
    WINDOWS MANAGEMENT FRAMEWORK 5.1 FOR Windows Server 2012
  • Great, the installation is started now
    Install WINDOWS MANAGEMENT FRAMEWORK 5.1 FOR Windows Server 2012
  • You will need to restart the server to complete the installation.
    restart for WINDOWS MANAGEMENT FRAMEWORK 5.1

    Installing Windows Management Framework requires a server restart, and it will not be installed until the server rebooted.

  • After restart, try now to run the 'Install-Module' cmdlet that should be now recognized and working properly.
    Solving The term 'Install-Module' is not recognized as the name of a cmdlet
If you don’t ask, the answer is always NO!
...