51

I was trying to install Azure using Install-Module Azure in PowerShell. I got the following error:

PS C:\Windows\system32> Install-Module Azure
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 corre
ct and try again.
At line:1 char:1
+ Install-Module Azure
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Why is PS not recognizing the basic Install module? Without this I can't even install Azure. What should I do?

12 Answers 12

26

Another GUI based option to fix this error is to download the PackageManagement PowerShell Modules (msi installer) from Microsoft website and install the modules.

Once this is installed you will not get the error 'Install-Module' is not recognized as the name of a cmdlet.

3
  • This seemed like it would be a cool work-around, Unfortunately this has the same issue - you need powershell 3+ and dotnet 4.5 installed first... which would then give you the command "install-module" anyway.
    – Hicsy
    Commented Jun 4, 2018 at 5:34
  • 6
    The link is broken.
    – cdonner
    Commented Feb 11, 2020 at 19:15
  • 2
    Fixed the broken link Commented Sep 17, 2020 at 23:32
24

Since you are using the lower version of PS:

What you can do in your case is you first download the module in your local folder.

Then, there will be a .psm1 file under that folder for this module.

You just

import-Module "Path of the file.psm1"

Here is the link to download the Azure Module: Azure Powershell

This will do your work.

9
  • What do you mean by "download the module in your local folder"? Can I download it from the internet? Commented Jan 11, 2017 at 8:49
  • @santafebound: Yes of course you can download the module from Internet. I think it is already there in Github.. Commented Jan 11, 2017 at 8:52
  • 1
    @santafebound : I have modified the answer and given you the Github link to download the module .. :) Commented Jan 11, 2017 at 8:55
  • Thanks. I'll take a look now! Commented Jan 11, 2017 at 10:48
  • @santafebound: Accept the answer it it helps you. Commented Jan 11, 2017 at 13:19
16

You should install the latest version of PowerShell, then use this command Install-Module Azure to install azure module. Because from Powershell 5.0 onwards you , you will be able to use the cmdlet to Install-Module, Save-Module

PS > $psversiontable
Name                           Value
----                           -----
PSVersion                      5.1.14393.576
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.576
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

More information about install Azure PowerShell, refer to the link.

2
  • 6
    Here is a link for powershell 5.0 microsoft.com/en-us/download/… Commented Jan 17, 2017 at 15:13
  • 2
    This might not be the issue in all cases. I have PSVersion 5.1.18362.145 and Install-Module is [still] not recognized as the name of a cmdlet, function, script file, or operable program.
    – Jason
    Commented Jan 14, 2020 at 19:26
10

I have Windows 10 and PowerShell 5.1 was already installed. For whatever reason the x86 version works and can find "Install-Module", but the other version cannot.

Search your Start Menu for "powershell", and find the entry that ends in "(x86)":

Windows 10 Start Menu searching for PowerShell

Here is what I experience between the two different versions:

PowerShell x86 vs x64 running Install-Module cmdlet comparison

3

I lost couple of days trying to resolve this until I got a simple solution. I just copy from another Win10 machine with a working Powershell 5.1 installation the following directories:

  • C:\Program Files\WindowsPowerShell\Modules\PackageManagement
  • C:\Program Files\WindowsPowerShell\Modules\PowerShellGet

To the same directories in the problem machine and don't change permissiones or anything and just run the command Install-Module and the problem was solved. I hope this can help some tormented soul.

1

Run the below commands as admin to install NuGet using Powershell:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Install-PackageProvider -Name NuGet
0

If you are trying to install a module that is listed on the central repository for PS content called PowerShell Gallery, you need to install PowerShellGet. Then the command will be available. I'm currently using PS 4.0. Installing PowerShellGet did the trick for me.

Source:

With the latest PowerShellGet module, you can:

  • Search through items in the Gallery with Find-Module and Find-Script
  • Save items to your system from the Gallery with Save-Module and Save-Script
  • Install items from the Gallery with Install-Module and Install-Script
  • Upload items to the Gallery with Publish-Module and Publish-Script
  • Add your own custom repository with Register-PSRepository

Another great article to get started with PS Gallery.

0

I didn't have the NuGet Package Provider, you can check running Get-PackageProvider:

PS C:\WINDOWS\system32> Get-PackageProvider 

Name                     Version          DynamicOptions                                                                                                                 
----                     -------          --------------                                                                                                                 
msi                      3.0.0.0          AdditionalArguments                                                                                                            
msu                      3.0.0.0                                                                                                                                         
NuGet  <NOW INSTALLED>   2.8.5.208        Destination, ...                             

The solution was installing it by running this command:

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force

If that fails with the error below you can copy/paste the NuGet folder from another PC (admin needed): C:\Program Files\PackageManagement\ProviderAssemblies\NuGet:

WARNING: Unable to download from URI 'https://onegetcdn.azureedge.net/providers/Microsoft.PackageManagement.NuGetProvider-2.8.5.208.dll' to ''.
WARNING: Failed to bootstrap provider 'https://onegetcdn.azureedge.net/providers/nuget-2.8.5.208.package.swidtag'.
WARNING: Failed to bootstrap provider 'nuget'.
WARNING: The specified PackageManagement provider 'NuGet' is not available.
PackageManagement\Install-PackageProvider : Unable to download from URI 
'https://onegetcdn.azureedge.net/providers/Microsoft.PackageManagement.NuGetProvider-2.8.5.208.dll' to ''.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\PSModule.psm1:6463 char:21
+             $null = PackageManagement\Install-PackageProvider -Name $script:NuGe ...
0

I was running an older server where I couldn't run install-module because the PowerShell version was 4.0. You can check the PowerShell version using the PowerShell command line

ps>HOST . 

https://gallery.technet.microsoft.com/office/PowerShell-Install-Module-388e47a1

Use this link to download necessary updates. Check to see if your Windows version needs the update.

1
  • the link is broken
    – toscanelli
    Commented Jan 9, 2024 at 10:07
0

I think the answer posted by Jeremy Thompson is the correct one, but I don't have enough street cred to comment. Once I updated nuget and powershellget, Install-Module was available for me.

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force 
Install-PackageProvider -Name Powershellget -Force

What is interesting is that the version numbers returned by get-packageprovider didn't change after the update.

0

The fix for me was to use PowerShell 7 instead of 5 (Windows Terminal).

Get latest Powershell 7.* version, which is now cross platform https://github.com/PowerShell/PowerShell

-1

Actually my solution to this problem was much simpler, because I already had the latest version of PowerShell and is still didn't recognize Install-Module command. What fixed the "issue" for me was just typing the command manually, since originally I tried copying the snippet from a website and apparently there was some issue with the formatting when copy&pasting, so when I typed the command manually it installed the module without any problem.

1
  • Same thing just happened to me - typing manually instead of copy&paste saved the day after 10 minutes of teeth grinding. Thanks for heads up Commented Jul 31, 2018 at 10:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.