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
Exit

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
Exit

Use Update-Module to get newer versions.

Update-Module -Name PowerShellGet
Exit

For computers running PowerShell 3.0 or PowerShell 4.0

These instructions apply to computers that have the PackageManagement Preview installed or don't have any version of PowerShellGet installed.

The Save-Module cmdlet is used in both sets of instructions. Save-Module downloads and saves a module and any dependencies from a registered repository. The module's most current version is saved to a specified path on the local computer, but isn't installed. For more information, see Save-Module.

Computers with the PackageManagement Preview installed

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

    Save-Module -Name PowerShellGet -Path C:\LocalFolder -Repository PSGallery
    
  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
    

Computers without PowerShellGet

For computer's without any version of PowerShellGet installed, a computer with PowerShellGet installed is needed to download the modules.

  1. From the computer that has PowerShellGet installed, use Save-Module to download the current version of PowerShellGet. Two folders are downloaded: PowerShellGet and PackageManagement. Each folder contains a subfolder with a version number.

    Save-Module -Name PowerShellGet -Path C:\LocalFolder -Repository PSGallery
    
  2. Copy the PowerShellGet and PackageManagement folders to the computer that doesn't have PowerShellGet installed.

    The destination directory is: $env:ProgramFiles\WindowsPowerShell\Modules