PowerShell package management
A structured aproach to software discovery, installation, and management
Published in Articles on by Michiel van Oosterhout ~ 5 min read
PowerShell's built-in package management offers a structured approach for discovering, installing, and managing software from different sources.
Package management
Conceptually package management is
- discovering software packages;
- installing the software contained in (or referred to by) said software packages;
- and keeping inventory so installed software can be updated and uninstalled.
This concept is codified in an ISO standard that establishes specifications for tagging software to optimize its identification and management
, and in the software identification tag (sometimes referred to as the swidtag).
PowerShell package management
PowerShell package management delegates these responsibilities to package providers, implementations of the PowerShell package management functions (e.g. Find-Package
, Install-Package
, and Uninstall-Package
). A package provider may support the registration of one or more package sources, named locations where software packages can be discovered and installed from.
As such every software package can be identified by its canonical ID: {provider}:{package}/{version}#{source}
/{version}
and #{source}
are both optional).
PowerShell's package management is itself distributed as a software package named PackageManagement. This particular software package is of the PowerShell module type. PowerShell modules typically contain .NET classes, functions, and cmdlets for use in PowerShell itself. The PackageManagement PowerShell module contains foundational classes like SoftwareIdentity
, and essential functions like Install-PackageProvider
and Register-PackageSource
.
Package providers
PowerShell includes 1 special package provider, the Bootstrap package provider, which can bootstrap a very select few package providers, the NuGet and PSL package providers. On Windows PowerShell, the NuGet package provider is already bootstrapped. An old version of the PowerShellGet package provider is also present by default.
The Bootstrap package provider
The Bootstrap package provider is used to bootstrap a small set of 'special' package providers (invoke Find-Package -Provider Bootstrap
to list them). These special package providers are distributed as .NET assemblies, and installed into %ProgramFiles%\PackageManagement\ProviderAssemblies
on Windows. A single package source is registered for this package provider (source for Windows PowerShell, source for PowerShell), the contents of which were maintained on GitHub.

The Bootstrap package provider is the fallback handler for the Install-PackageProvider
function. (Normally that command is handled by the PowerShellGet package provider.) It will also bootstrap a missing package provider when invoking Install-Package
with the -ForceBootstrap
switch (using the -ProviderName
to determine the package provider to bootstrap).
The NuGet package provider
The NuGet package provider can discover, install, and manage NuGet packages from package sources that implement version 2 of the NuGet protocol. This package provider is a dependency of the PowerShellGet package provider. There is no package source registered with the NuGet package provider by default. The NuGet gallery at www.nuget.org can be registered as a package source for the NuGet package provider (for example to obtain dependencies of a script that are distributed there).
The PSL package provider
The Package Source List package provider can discover, install, and manage a variety of package types listed in source list files, text files that use JSON to describe the available packages, their type and location, and additional metadata required for installation. Source list files can only be hosted locally or on a network share, and must be signed if they are hosted on a network share. This package provider was designed to meet the needs of enterprise administrators. To install the PSL package provider, invoke Install-Package -Name PSL -Provider Bootstrap
.
The PowerShellGet package provider
The PowerShellGet package provider can discover, install, and manage PowerShell scripts and PowerShell modules. This package provider is itself distributed as a PowerShell module, so it's turtles all the way down.
PowerShell scripts and modules are distributed through package sources that implement version 2 of the NuGet protocol, which is why the PowerShellGet package provider depends on the NuGet package provider. The official package source for the PowerShellGet package provider is the PowerShell Gallery.
An out-of-date version of the PowerShellGet package provider is present by default, and cannot be removed. An up-to-date version can be installed side-by-side by invoking Install-PackageProvider -Name PowerShellGet
. And because this package provider is itself distributed as a PowerShell module, it can also be installed by invoking Install-Module -Name PowerShellGet
.
Additional package providers
Additional package providers are distributed as PowerShell modules, typically through the PowerShell Gallery. A PowerShell module tagged PackageManagement and Provider, and containing the relative path to the implementation file(s) under the PrivateData.PackageManagementProviders
key in its manifest, is considered a package provider. One example of such a package provider is the Gist package provider, a package provider that can discover, install, and manage PowerShell scripts distributed as GitHub gists, small code snippets hosted on https://gist.github.com.
Summary
PowerShell has an abstraction of package management, implemented by multiple package providers. The NuGet package provider is included by default or can be bootstrapped. The PowerShellGet package provider is also included by default, and a newer version can be installed. Additional package providers are distributed as PowerShell modules through the PowerShellGet package provider's official package source, the PowerShell Gallery.
Updates
- Added a class diagram to illustrate the relationship between package providers and the package management feature.
- Added a diagram to illustrate the different ways package providers can be grouped.