Installing PowerShellGet

PowerShellGet is an in-box module in the following releases

Get PowerShellGet module for PowerShell versions 3.0 and 4.0

  • Before updating PowerShellGet, you should always install the latest Nuget provider. To do that, run the following in an elevated PowerShell session.

    Install-PackageProvider Nuget –Force

For systems with PowerShell 5.0 (or newer) you can install the latest PowerShellGet

  • To do this on Windows 10, Windows Server 2016, any system with WMF 5.0 or 5.1 installed, or any system with PowerShell 6, run the following commands from an elevated PowerShell session.

    Install-Module –Name PowerShellGet –Force
  • Use Update-Module to get newer versions.

    Update-Module -Name PowerShellGet

For systems running PowerShell 3 or PowerShell 4, that have installed the PackageManagement MSI

  • Use below PowerShellGet cmdlet from an elevated PowerShell session to save the modules to a local directory

    Save-Module PowerShellGet -Path C:\LocalFolder
  • Ensure that PowerShellGet and PackageManagement modules are not loaded in any other processes.

  • Delete contents of $env:ProgramFiles\WindowsPowerShell\Modules\PowerShellGet\ and $env:ProgramFiles\WindowsPowerShell\Modules\PackageManagement\ folders.

  • Re-open the PS Console with elevated permissions then run the following commands.

    Copy-Item "C:\LocalFolder\PowerShellGet\*" "$env:ProgramFiles\WindowsPowerShell\Modules\PowerShellGet\" -Recurse -Force
    Copy-Item "C:\LocalFolder\PackageManagement\*" "$env:ProgramFiles\WindowsPowerShell\Modules\PackageManagement\" -Recurse -Force