Installing PowerShellGet

PowerShellGet is an in-box module in the following releases

Before updating PowerShellGet, you should always install the latest NuGet provider. From an elevated PowerShell session, run the following command.

Install-PackageProvider -Name NuGet -Force

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

To install PowerShellGet 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 Preview

  1. From an elevated PowerShell session, use Save-Module to save the modules to a local directory.

    Save-Module -Name PowerShellGet -Path C:\LocalFolder
  2. Ensure that the PowerShellGet and PackageManagement modules aren't loaded in any other processes.

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

  4. Reopen the PowerShell console with elevated permissions and 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