Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .openpublishing.redirection.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"redirections": [
{
"redirect_document_id": true,
"redirect_url": "/powershell/gallery/powershellget/update-powershell-51",
"redirect_document_id": false,
"redirect_url": "/powershell/gallery/powershellget/install-powershellget",
"source_path": "powershell-gallery/docs-conceptual/powershellget/install-on-older-systems.md"
},
{
"redirect_document_id": false,
"redirect_url": "/powershell/gallery/powershellget/install-powershellget",
"source_path": "powershell-gallery/docs-conceptual/powershellget/update-powershell-51.md"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: This article explains how to install the required NuGet components for Windows PowerShell 5.1.
ms.date: 01/27/2025
description: >-
This article explains how to manually install the required NuGet components for Windows PowerShell 5.1.
ms.date: 01/26/2026
title: Bootstrapping NuGet
---
# Bootstrap the NuGet components for Windows PowerShell 5.1
Expand All @@ -10,28 +11,18 @@ components to interact with the PowerShell Gallery. PowerShellGet includes logic
components as long as you can connect to the PowerShell Gallery. If the machine isn't connected to
the internet, you must copy required files from a trusted source to the disconnected machine.

The required NuGet components are included in PowerShellGet v2+ and PackageManagement v1.1+. Newer
versions of these modules are available from the PowerShell Gallery and included in PowerShell 6 and
higher. These instructions are for Windows PowerShell 5.1.
The updated NuGet provider is required by the commands work with the PowerShell Gallery. The
Comment thread
sdwheeler marked this conversation as resolved.
Outdated
`Publish-*` commands use `nuget.exe` to publish resources.

> [!IMPORTANT]
> After bootstrapping the NuGet components, you must install latest versions of the PowerShellGet
> and PackageManagement modules to be supported.
## Install the latest version of PowerShellGet on an internet-connected machine

## Bootstrap on an internet-connected machine

The following processes assume the machine is connected to the internet and can download files from
a public location.

### ERROR: NuGet provider is required to continue

You receive this error when the NuGet provider isn't available on the machine.
To install the latest version of PowerShellGet, run the following command:

```powershell
Find-Module -Repository PSGallery -Verbose -Name Contoso
Install-Module -Name PowerShellGet -Repository PSGallery
```

Answer the prompt with `Y` to install the NuGet provider.
Answer the prompt with <kbd>Y</kbd> to install the NuGet provider.

```Output
NuGet provider is required to continue
Expand All @@ -43,72 +34,68 @@ ame NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to instal
ort the NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
VERBOSE: Installing NuGet provider.

Version Name Type Repository Description
------- ---- ---- ---------- -----------
2.5 Contoso Module PSGallery Contoso module
```

### ERROR: NuGet.exe is required to continue
When you answer <kbd>Y</kbd>, PowerShellGet installs the NuGet provider and the `nuget.exe`
command-line tool (if necessary).

You receive this error when the NuGet provider is available, but the `nuget.exe` binary isn't.
> [!NOTE]
> When you install PowerShellGet, it automatically installs the latest version of
> PackageManagement.

```powershell
Publish-Module -Name Contoso -Repository PSGallery -Verbose
```

Answer the prompt with `Y` to install `nuget.exe`.
## Copy the required files to the isolated computer

```Output
NuGet.exe is required to continue
PowerShellGet requires NuGet.exe to publish an item to the NuGet-based repositories. NuGe
t.exe must be available under one of the paths specified in PATH environment variable val
ue. Do you want PowerShellGet to install NuGet.exe now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
VERBOSE: Installing NuGet.exe.
VERBOSE: Successfully published module 'Contoso' to the module publish location 'https://
www.powershellgallery.com/api/v2/'.
Please allow few minutes for 'Contoso' to show up in the search results.
```
After installing the updates on the internet-connected machine, manually copy the components to the
isolated node through a trusted offline process.

### ERROR: NuGet.exe and NuGet provider are required to continue
1. Copy the PowerShellGet and PackageManagement modules to the offline machine. Use the following
command to location the modules on the source machine:

You receive this error when both the NuGet provider and `nuget.exe` aren't installed.
```powershell
Get-Module PowerShellGet, PackageManagement -ListAvailable |
Sort-Object Version -Descending |
Select-Object Path -First 2
```

```powershell
Publish-Module -Name Contoso -Repository PSGallery -Verbose
```
The result should look similar to the following output:

Answer the prompt with `Y` to install both the NuGet provider and `nuget.exe`.
```Output
Path
----
C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PowerShellGet.psd1
C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\PackageManagement.psd1
```

```Output
NuGet.exe and NuGet provider are required to continue
PowerShellGet requires NuGet.exe and NuGet provider version '2.8.5.201' or newer to inter
act with the NuGet-based repositories. Do you want PowerShellGet to install both NuGet.ex
e and NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
VERBOSE: Installing NuGet provider.
VERBOSE: Installing NuGet.exe.
VERBOSE: Successfully published module 'Contoso' to the module publish location 'https://
www.powershellgallery.com/api/v2/'.
Please allow few minutes for 'Contoso' to show up in the search results.
```
Copy the entire module folders to the same location on the isolated machine. For example, if the
modules are located in `PowerShellGet\2.2.5` and `PackageManagement\1.4.8.1` folders to the
`$env:PROGRAMFILES\WindowsPowerShell\Modules` folder on the target machine.

## Bootstrap on a machine not connected to the internet
1. Copy `nuget.exe` to the isolated machine. PowerShellGet installs `nuget.exe` in the following
location: `$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet\nuget.exe`

The following processes assume the machine isn't connected to the internet. To install the necessary
components, follow the bootstrap process on an internet-connected machine then manually copy the
provider to the isolated node through an offline trusted process.
If that file isn't present at that location it's either installed somewhere else or PowerShellGet
found the .NET CLI (`dotnet.exe`). You can download the latest version of `nuget.exe` from
[https://aka.ms/psget-nugetexe][01].

1. Copy the NuGet provider files to the offline machine.
Copy `nuget.exe` to `$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet\nuget.exe` on
the target computer.

Copy the `C:\Program Files\PackageManagement\ProviderAssemblies\NuGet` folder from the connected
machine to the same location on the offline machine.
## Unblock the copied files

1. Copy the PowerShellGet and PackageManagement modules to the offline machine.
When you copy files from another computer, Windows may block the files. To unblock the copied files,
run the following commands on the target machine:

Copy the following module folders from the connected machine to same location on the offline
machine.
```powershell
$getChildItemSplat = @{
Path = @(
"$env:PROGRAMFILES\WindowsPowerShell\Modules\PowerShellGet"
"$env:PROGRAMFILES\WindowsPowerShell\Modules\PackageManagement"
"$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet\nuget.exe"
)
Recurse = $true
}
Get-ChildItem @getChildItemSplat | Unblock-File
```

- `C:\Program Files\WindowsPowerShell\Modules\PowerShellGet`
- `C:\Program Files\WindowsPowerShell\Modules\PackageManagement`
<!-- link references -->
[01]: https://aka.ms/psget-nugetexe
17 changes: 7 additions & 10 deletions powershell-gallery/docs-conceptual/overview.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: The PowerShellGet module provides commands to interact with the PowerShell Gallery, the central repository for PowerShell modules, scripts, and DSC resources.
ms.date: 11/16/2022
ms.date: 01/26/2026
ms.topic: overview
title: PowerShellGet and the PowerShell Gallery
---
Expand All @@ -11,20 +11,19 @@ PowerShell scripts, modules containing PowerShell cmdlets and Desired State Conf
resources. Some of these packages are authored by Microsoft, and others are authored by the
PowerShell community.

The [PowerShellGet][07] module contains cmdlets for discovering, installing, updating, and
The [PowerShellGet][02] module contains cmdlets for discovering, installing, updating, and
publishing PowerShell packages from the PowerShell Gallery. These packages can contain artifacts
such as Modules, DSC Resources, Role Capabilities, and Scripts. Make sure you have the latest
version of **PowerShellGet** and **PackageManagement** installed.

The [Microsoft.PowerShell.PSResourceGet][08] module replaces the **PowerShellGet** and
The [Microsoft.PowerShell.PSResourceGet][01] module replaces the **PowerShellGet** and
**PackageManagement** modules. **Microsoft.PowerShell.PSResourceGet** version 1.0.1 ships in
PowerShell 7.4.0. The latest version is available in the PowerShell Gallery and can be installed on
any supported version of PowerShell.

For more information see:

- [Install PowerShellGet][01]
- [Update PowerShellGet for Windows PowerShell][02]
- [Install a package manager for PowerShell][07]

## Getting Started with the PowerShell Gallery

Expand All @@ -38,12 +37,10 @@ Provide feedback and report issues in the [GitHub repository][04]. To see the cu
PowerShell Gallery services, see the [PowerShell Gallery Status][05] page on GitHub.

<!-- link references -->
[01]: powershellget/install-powershellget.md
[02]: powershellget/update-powershell-51.md
[01]: /powershell/module/microsoft.powershell.psresourceget
[02]: /powershell/module/powershellget
[03]: getting-started.md
[04]: https://aka.ms/psgallery-issues
[05]: https://aka.ms/psgallery-status
[06]: https://www.powershellgallery.com
[07]: /powershell/module/powershellget
[08]: /powershell/module/microsoft.powershell.psresourceget

[07]: powershellget/install-powershellget.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
---
description: This article explains how install PowerShellGet.
ms.date: 01/31/2024
ms.date: 01/26/2026
ms.topic: install-set-up-deploy
title: How to Install PowerShellGet
title: Install a package manager for PowerShell
---
# How to Install PowerShellGet and PSResourceGet
# Install a package manager for PowerShell

## Prerequisites
If you are running PowerShell 6.0 or later, you already have a newer version of **PowerShellGet**
and **PackageManagement** installed. You should ensure you are running the latest versions of those
modules.

Ensure that you have a version of **PowerShellGet** and **PackageManagement** newer than 1.0.0.1
installed. The latest stable versions are 2.2.5 for **PowerShellGet** and 1.4.8.1 for
**PackageManagement**.
If you are running PowerShell 7.4 or later, you also have **Microsoft.PowerShell.PSResourceGet**
installed. **Microsoft.PowerShell.PSResourceGet** is the new package management solution for
PowerShell. With this module, you no longer need to use **PowerShellGet** and **PackageManagement**.
It's installed side-by-side with the existing **PowerShellGet** and **PackageManagement** modules.

If you're running Windows PowerShell 5.1 with **PowerShellGet** 1.0.0.1, see
[Update PowerShellGet for Windows PowerShell 5.1](update-powershell-51.md).
Windows PowerShell ships with version 1.0.0.1 of **PowerShellGet** and **PackageManagement**. If
you're running Windows PowerShell 5.1, you must upgrade to the latest version of PowerShellGet and
PackageManagement. All versions of PowerShellGet v1.x are no longer supported.

Use the following instructions to install or update to the latest versions of these modules.

## Step 1: Enable TLS 1.2

To access the PowerShell Gallery, you must use Transport Layer Security (TLS) 1.2 or higher. Use the
following command to enable TLS 1.2 in your PowerShell session.
Expand All @@ -27,17 +35,16 @@ following command to enable TLS 1.2 in your PowerShell session.
Add this command to your PowerShell profile script to ensure TLS 1.2 is configured for every
PowerShell session. For more information about profiles, see [about_Profiles][01].

If you're running PowerShell 6.0 or later, you already have a newer version of **PowerShellGet** and
**PackageManagement** installed. You can upgrade to a newer version if necessary or install the
preview release. You should always install the latest stable release.
## Step 2: Check the installed versions

Use the following command to see what version is installed.
To check the currently installed versions of the modules, run the following command:

```powershell
Get-Module PowerShellGet, PackageManagement -ListAvailable
$Names = @('PowerShellGet', 'PackageManagement', 'Microsoft.PowerShell.PSResourceGet')
Get-Module -Name $Names -ListAvailable
```

The following output shows that the latest stable version needs to be installed.
In Windows PowerShell 5.1 on a newly installed Windows system, you should get the following output:

```Output
Directory: C:\Program Files\WindowsPowerShell\Modules
Expand All @@ -49,27 +56,69 @@ Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, ...
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, ...
```

## Install the latest stable release
If you the version of **PowerShellGet** is newer than `1.0.0.1` then you can
Comment thread
sdwheeler marked this conversation as resolved.
Outdated
[check for updates][02] and [install the latest release][03].

To install the latest versions of these modules run the following:
If you are still running version `1.0.0.1`, you must follow the steps let **PowerShellGet** install
Comment thread
sdwheeler marked this conversation as resolved.
Outdated
an updated NuGet provider and the `nuget.exe` command-line tool. Continue to the next step.

## Step 3: Check for updates

To check for the latest versions of the modules available from the PowerShell Gallery, run the
following command:

```powershell
Install-Module PowerShellGet -Force -AllowClobber
$Names = @('PowerShellGet', 'PackageManagement', 'Microsoft.PowerShell.PSResourceGet')
Find-Module -Name $Names -Repository PSGallery
```

You should get a result similar to the following output:

```Output
Version Name Repository Description
------- ---- ---------- -----------
1.4.8.1 PackageManagement PSGallery PackageManagement (a.k.a. OneGet) is a n…
2.2.5 PowerShellGet PSGallery PowerShell module with commands for disc…
1.1.1 Microsoft.PowerShell.PSResourceGet PSGallery PowerShell module with commands for disc…
```

## Step 4: Update NuGet components (if required)

An updated NuGet provider is required by **PowerShellGet** commands to work with the PowerShell
Gallery. The `Publish-*` commands use `nuget.exe` or `dotnet.exe` to publish resources. If neither
tool is available, PowerShellGet installs `nuget.exe`. If you are still running version `1.0.0.1` of
**PowerShellGet**, `Find-Module` prompts you to install the NuGet provider. Enter <kbd>Y</kbd> to
install the provider.

```Output
NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet
-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageMan
agement\ProviderAssemblies' or 'C:\Users\user1\AppData\Local\PackageManagement\ProviderAs
semblies'. You can also install the NuGet provider by running 'Install-PackageProvider -N
ame NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and imp
ort the NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
VERBOSE: Installing NuGet provider.
```

## Install Microsoft.PowerShell.PSResourceGet
When you answer <kbd>Y</kbd>, PowerShellGet installs the NuGet provider and the `nuget.exe`
command-line tool (if necessary).

**Microsoft.PowerShell.PSResourceGet** is the new package management solution for PowerShell. With
this module, you no longer need to use **PowerShellGet** and **PackageManagement**. However, it can
be installed side-by-side with the existing **PowerShellGet** module. To install
**Microsoft.PowerShell.PSResourceGet** side-by-side with your existing **PowerShellGet** version,
open any PowerShell console and run:
## Step 5: Install the latest release

To install the latest versions of these modules run the following:

```powershell
Install-Module PowerShellGet -Repository PSGallery -Force -AllowClobber
Install-Module Microsoft.PowerShell.PSResourceGet -Repository PSGallery
```

**Microsoft.PowerShell.PSResourceGet** is preinstalled with PowerShell 7.4 and later.
> [!NOTE]
> When you install **PowerShellGet**, it automatically installs the latest version of
> **PackageManagement**.

<!-- link references -->
[01]: /powershell/module/microsoft.powershell.core/about/about_profiles
[02]: #step-3-check-for-updates
[03]: #step-5-install-the-latest-release
Loading