The PowerShell Gallery
Last updated
Last updated
The PowerShell Gallery is the central public repository for PowerShell modules, scripts, and other resources. It’s a hub where developers, IT professionals, and enthusiasts share their work, making it easier for others to find and use pre-built solutions. The gallery is sponsored and funded by Microsoft, ensuring its reliability and accessibility.
The PowerShell Gallery is a repository that hosts:
Modules: Collections of cmdlets, functions, and other resources.
Scripts: Standalone PowerShell scripts for specific tasks.
DSC Resources: Desired State Configuration resources for automating system configurations.
It includes contributions from Microsoft, third-party companies, and the PowerShell community. Many projects on the gallery originate from GitHub, where they are developed as open-source projects.
You can access the PowerShell Gallery in two ways:
Via the Website: Visit to browse and search for modules and scripts.
Via PowerShell: Use PowerShell cmdlets to search, download, and install modules and scripts directly from the gallery.
Using the Website
The website allows you to filter and search for modules and scripts using keywords. It’s user-friendly and provides detailed information about each item, including version history, dependencies, and installation instructions.
Using PowerShell
You can search the gallery directly from PowerShell using the following cmdlets:
Find-Module: Searches for modules.
Find-Script: Searches for scripts.
For example:
This command searches for modules related to Azure.
Saving Modules/Scripts
To download a module or script without installing it, use:
This saves the module or script to the specified folder for testing or offline use.
Installing Modules/Scripts
To install a module or script for use in PowerShell, use:
For Current User (does not require admin rights):
For All Users (requires admin rights):
Default Installation Paths
Modules:
Current User: $env:USERPROFILE\Documents\WindowsPowerShell\Modules
All Users: $env:ProgramFiles\WindowsPowerShell\Modules
Scripts:
Current User: $env:USERPROFILE\Documents\WindowsPowerShell\Scripts
All Users: $env:ProgramFiles\WindowsPowerShell\Scripts
Listing Installed Modules/Scripts
To see which modules and scripts are installed from the gallery:
Updating Modules/Scripts
To update all installed modules and scripts:
To update a specific module or script:
Uninstalling Modules/Scripts
To remove a module or script:
If two modules contain functions or cmdlets with the same name, the last module loaded takes precedence. To avoid conflicts, you can explicitly call a function or cmdlet from a specific module using the module name as a namespace:
The PowerShellGet module provides cmdlets for interacting with the PowerShell Gallery. Under the hood, it relies on the PackageManagement module, which handles package providers and sources.
Package Providers
A package provider is a DLL that allows PowerShell to work with specific package formats (e.g., NuGet, MSI). To see installed providers:
Package Sources
A package source is a repository (like the PowerShell Gallery or NuGet) that hosts packages. To see available sources:
NuGet is a popular package manager for .NET developers. It’s also integrated with PowerShell, allowing you to search and install NuGet packages:
Before modules, PowerShell used snap-ins to extend functionality. Snap-ins are compiled DLLs that require installation and registry modifications. While still supported, they are deprecated in favor of modules.
Listing Snap-Ins
To see loaded snap-ins:
Loading Snap-Ins
To load a snap-in: