PowerShell Gallery: Find and Install Modules

The PowerShell Gallery (powershellgallery.com) is Microsoft’s public repository of PowerShell modules and scripts. You search it and install from it right in the console:

Find-Module -Name Microsoft.PowerShell.TextUtility | Select-Object Name, Version, Author

Output:

Name                             Version Author
----                             ------- ------
Microsoft.PowerShell.TextUtility 0.5.0   Microsoft Corporation

No account is needed to download. In this tutorial, I’ll show you how to search the Gallery, inspect a module before you trust it, install it without admin rights, and where PSResourceGet fits in.

What is the PowerShell Gallery?

It’s the central repository for PowerShell content: modules with cmdlets, standalone scripts and DSC resources. Microsoft publishes some packages, and community authors publish the rest.

That second part matters. Microsoft scans uploads, but it doesn’t vouch for community code, so treat every package as untrusted until you’ve checked it.

Two modules talk to the Gallery: the older PowerShellGet and the newer Microsoft.PowerShell.PSResourceGet. Which ones you have depends on your version, so check your PowerShell version first:

$names = 'PowerShellGet', 'PackageManagement', 'Microsoft.PowerShell.PSResourceGet'
Get-Module -Name $names -ListAvailable | Sort-Object Name, Version | Format-Table Name, Version
"PSResourceGet commands: " + [bool](Get-Command Find-PSResource -ErrorAction SilentlyContinue)

Output:

Name                               Version
----                               -------
Microsoft.PowerShell.PSResourceGet 1.2.0
PackageManagement                  1.0.0.1
PackageManagement                  1.4.8.1
PowerShellGet                      1.0.0.1
PowerShellGet                      2.2.5

PSResourceGet commands: True

The output above is from PowerShell 7.6. It ships PowerShellGet 2.2.5 and PSResourceGet 1.2.0, and it also lists the 1.0.0.1 copies that belong to Windows PowerShell.

Windows PowerShell 5.1 showed only PowerShellGet and PackageManagement 1.0.0.1, plus PSResourceGet commands: False. Microsoft says PowerShellGet 1.x is no longer supported, which is a good reason to update PowerShell on Windows 11.

How do I search the PowerShell Gallery?

The website works well for browsing. Type a name or keyword in the search box at the top of powershellgallery.com, then open the package from the results:

PowerShell Gallery website search box with a module name typed and the matching package in the results
Searching the PowerShell Gallery website for a module

From the console, Find-Module searches by name, and wildcards work. -Tag searches the tags authors attach to their packages:

(Find-Module -Name 'Microsoft.PowerShell.*').Count
Find-Module -Tag Excel |
    Sort-Object { [int]$_.AdditionalMetadata.downloadCount } -Descending |
    Select-Object -First 3 -Property Name, Version

Output:

15

Name         Version
----         -------
ImportExcel  7.8.10
PSExcel      1.0.2
PSWriteExcel 0.1.15

Fifteen Microsoft.PowerShell modules came back, and ImportExcel led the Excel tag by downloads. The results are objects, so Select-Object in PowerShell trims them to the columns you need.

Find the module that has a command

Know the command b