Edit

Manual Package Download

The PowerShell Gallery supports downloading a package from the website directly, without using the PowerShellGet cmdlets. You can download any package as a NuGet package (.nupkg) file, which you can then copy to an internal repository.

Note

Manual package download is not intended as a replacement for the Install-Module cmdlet. Downloading the package doesn't install the module or script. Dependencies aren't included in the NuGet package downloaded. The following instructions are provided for reference purposes only.

Using manual download to acquire a package

  1. Go to the PowerShell Gallery: https://www.powershellgallery.com

  2. In the search box, search for the module or script name.

  3. Select the package you want from the results.

  4. On the package details page under Installation Options, select the Manual Download tab.

    Screenshot of the package details page with install options.

  5. Select Download the raw nupkg file. A copy of the package is copied to the download folder for your browser with the name <name>.<version>.nupkg.

A NuGet package is a ZIP archive containing information about the contents of the package. To expand the package, rename the .nupkg file to .zip and extract the contents to a local folder using Expand-Archive or some other ZIP file tool.

A NuGet package file includes the following NuGet-specific elements that aren't part of the original packaged code:

  • A folder named _rels - contains a .rels file that lists the dependencies
  • A folder named package - contains the NuGet-specific data
  • A file named [Content_Types].xml - describes how extensions like PowerShellGet work with NuGet
  • A file named <name>.nuspec - contains the bulk of the metadata

Remove these elements to leave the PowerShell code created by the package author.

Installing PowerShell modules from a NuGet package

Note

These instructions DO NOT give the same result as running Install-Module. These instructions fulfill the minimum requirements. They aren't intended to be a replacement for Install-Module. Some steps performed by Install-Module aren't included.

The steps are as follows:

  1. Unblock the Internet-downloaded NuGet package (.nupkg) file, for example using Unblock-File -Path C:\Downloads\module.nupkg cmdlet.
  2. Extract the contents of the NuGet package to a local folder. The default folder name is usually <name>.<version>.
  3. Delete the NuGet-specific elements from the folder.
  4. Rename the folder to just the module name. Create a subfolder named based on the version of the module.
  5. Move the contents of the extracted folder into the version-specific subfolder.
  6. Copy the folder to one of the folders in the $env:PSModulePath value. $env:PSModulePath is a semicolon-delimited set of paths in which PowerShell should look for modules.

Important

The manual download doesn't include any dependencies required by the module. If the package has dependencies, they must be installed on the system for this module to work correctly. The PowerShell Gallery shows all dependencies required by the package.

Installing PowerShell scripts from a NuGet package

Note

These instructions DO NOT give the same result as running Install-Script. These instructions fulfill the minimum requirements. They aren't intended to be a replacement for Install-Script.

The easiest approach is to extract the NuGet package, then use the script directly.

The steps are as follows:

  1. Unblock the Internet-downloaded NuGet package (.nupkg) file, for example using Unblock-File -Path C:\Downloads\package.nupkg cmdlet.
  2. Extract the contents of the NuGet package.
  3. The .PS1 file in the folder can be used directly from this location.
  4. You may delete the NuGet-specific elements in the folder.

For the list of NuGet-specific elements, see Using manual download to acquire a package.

Important

The manual download doesn't include any dependencies required by the module. If the package has dependencies, they must be installed on the system for this module to work correctly. The PowerShell Gallery shows all dependencies required by the package.