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

后端 未结 10 877
刺人心
刺人心 2020-12-14 05:50

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

PS C:\\Windows\\system32> Install-Module A         


        
相关标签:
10条回答
  • 2020-12-14 06:27

    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 讨论(0)
  • 2020-12-14 06:30

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

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    
    Install-PackageProvider -Name NuGet
    
    0 讨论(0)
  • 2020-12-14 06:32

    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.

    0 讨论(0)
  • 2020-12-14 06:32

    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 "'Install-Module' is not recognized as the name of a cmdlet" error.

    0 讨论(0)
  • 2020-12-14 06:34

    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.

    0 讨论(0)
  • 2020-12-14 06:35

    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.

    0 讨论(0)
提交回复
热议问题