Skip to main content

How to Install Microsoft PowerShell PSResourceGet module

By March 24, 2024No Comments

PSResourceGet is a module with commands for discovering, installing, updating, and publishing PowerShell artifacts like Modules, DSC Resources, Role Capabilities, and Scripts. The PSResourceGet is the latest package manager and replaces the PowerShellGet v2 module. In this article, you will learn how to install Microsoft PowerShell PSResourceGet module.

Microsoft PowerShell PSResourceGet

The PSResourceGet is the module that provides the ability to install, update, and locate modules and scripts in repositories like the PowerShell Gallery.

The PSResourceGet is the new package manager for PowerShell. It replaces the PowerShellGet v2 module. Now you might ask why it hasn’t become v3? It was, in the initial phase of the project. Eventually it was decided to change the name during many breaking changes. You will find v3 in the PowerShell gallery as compatibility module.

Windows PowerShell 5.1 comes with version of PowerShellGet preinstalled. This version of PowerShellGet has limited features and doesn’t support the updated capabilities of the PowerShell Gallery. To install PSResourceGet, you must first update to the latest version of PowerShellGet.

Install Microsoft PowerShell PSResourceGet module

To install Microsoft PowerShell PSResourceGet module on your system, follow the steps below.

1. Set Windows PowerShell Execution Policy

By default, we can’t install scripts. To require all PowerShell scripts that you download from the internet are signed by a trusted publisher, run PowerShell as administrator, and run the cmdlet.

Set-ExecutionPolicy RemoteSigned -Force

Important: Close and re-open the elevated Windows PowerShell window to have the changes apply.

2. Install PowerShellGet module

Run PowerShell as administrator. Run the command Install-Module PowershellGet -Force. When asked to install NuGet provider, press Y and follow with Enter.

Install-Module PowershellGet -Force

If you get an error that it’s unable to install, read the article Unable to install NuGet provider for PowerShell.

3. Install Microsoft PowerShell PSResourceGet module

Install the Microsoft PowerShell PSResourceGet module.

Install-Module -Name Microsoft.PowerShell.PSResourceGet -Force

After you have installed Microsoft PowerShell PSResourceGet, you should open a new PowerShell session. PowerShell automatically loads the newest version of the module when you use a PowerShell cmdlet.

We also recommend that you register the PowerShell Gallery as a trusted repository. This will not prompt you to trust the reposority every time when you want to download a module.

Set-PSResourceRepository -Name PSGallery -Trusted

Get PSResourceGet module version

Verify that the PSResourceGet module is installed.

Get-PSResource Microsoft.PowerShell.PSResourceGet -Scope AllUsers | ft -AutoSize

The below PowerShell output appears.

Version Name                               Repository Description
------- ----                               ---------- -----------
1.0.2   Microsoft.PowerShell.PSResourceGet PSGallery  PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, Scripts, and DSC Resources.

Find PSResourceGet module latest available version

Find-Module Microsoft.PowerShell.PSResourceGet | ft -AutoSize

The below output appears.

Version Name                               Repository Description
------- ----                               ---------- -----------
1.0.2   Microsoft.PowerShell.PSResourceGet PSGallery  PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, Scripts, and DSC Resources.

Microsoft PowerShell PSResourceGet cmdlets

See the below list of all the cmdlets.

PSResourceGet cmdlet Description
Find-PSResource Searches for packages from a repository (local or remote), based on a name or other package properties.
Get-InstalledPSResource Returns modules and scripts installed on the machine via PowerShellGet.
Get-PSResourceRepository Finds and returns registered repository information.
Get-PSScriptFileInfo Returns the metadata for a script.
Import-PSGetRepository Finds the repositories registered with PowerShellGet and registers them for PSResourceGet.
Install-PSResource Installs resources from a registered repository.
New-PSScriptFileInfo The cmdlet creates a new script file, including metadata about the script.
Publish-PSResource Publishes a specified module from the local computer to PSResource repository.
Register-PSResourceRepository Registers a repository for PowerShell resources.
Save-PSResource Saves resources (modules and scripts) from a registered repository onto the machine.
Set-PSResourceRepository Sets information for a registered repository.
Test-PSScriptFileInfo Tests the comment-based metadata in a .ps1 file to ensure it’s valid for publication.
Uninstall-PSResource Uninstalls a resource that was installed using PowerShellGet.
Unregister-PSResourceRepository Removes a registered repository from the local machine.
Update-PSModuleManifest Updates a module manifest file.
Update-PSResource Downloads and installs the newest version of a package already installed on the local machine.
Update-PSScriptFileInfo This cmdlet updates the comment-based metadata in an existing script .ps1 file.

How to use Microsoft PowerShell PSResourceGet

Let’s have a look at how to install modules with PSResourceGet.


In our example, we like to install both modules:

  1. Microsoft Graph PowerShell module
  2. Microsoft Graph Beta PowerShell module

We don’t have to add the -TrustReposority parameter to the commands below because we already added PSGallery to the trusted repository in the previous install steps. But you might overlooked it, so let’s add it.

Note: Use the -Reinstall parameter in the command to install the latest version of a module even if the latest version is already installed. The installed version is overwritten. This allows you to repair a damaged installation of the module. If an older version of the module is installed, the new version is installed side-by-side in a new version-specific folder.

Install-PSResource Microsoft.Graph -Reinstall -Scope AllUsers -TrustRepository
Install-PSResource Microsoft.Graph.Beta -Reinstall -Scope AllUsers -TrustRepository

If you like to install a specific module version, use the -Version parameter.

Install-PSResource Microsoft.Graph -Version 2.14.0 -Scope AllUsers -TrustRepository
Install-PSResource Microsoft.Graph.Beta -Version 2.14.0 -Scope AllUsers -TrustRepository


Check which modules are installed on the machine.

Get-InstalledPSResource -Scope AllUsers

Filter the installed modules.

Get-InstalledPSResource Microsoft.Graph* -Scope AllUsers | Where-Object { $_.Name -notlike "Microsoft.Graph.Beta*" }
Get-InstalledPSResource Microsoft.Graph* -Scope AllUsers | Where-Object { $_.Name -like "Microsoft.Graph.Beta*" }

Let’s get the location path where the modules are installed.

Note: When you run the Install-PSResource cmdlet to install a module, it can be installed in a different location when running it from Windows PowerShell 5.1 or PowerShell 7.

Get-InstalledPSResource -Scope AllUsers | ft Name, InstalledLocation

The folder paths below are the default places where the module installations are installed. You can open the below folders in File Explorer.

Windows PowerShell 5.1 for current user:


Windows PowerShell 5.1 for all users:

C:\Program Files\WindowsPowerShell\Modules

PowerShell 7 for current user:


PowerShell 7 for all users:

C:\Program Files\PowerShell\Modules


If we like to uninstall a module with PSResourceGet, we need to use the Uninstall-PSResource cmdlet.

This will remove all Microsoft Graph modules.

Get-InstalledPSResource Microsoft.Graph* -Scope AllUsers | Uninstall-PSResource -Scope AllUsers -SkipDependencyCheck

You can always filter and remove the modules you don’t want.

Get-InstalledPSResource Microsoft.Graph* -Scope AllUsers | Where-Object { $_.Name -notlike "Microsoft.Graph.Beta*" } | Uninstall-PSResource -Scope AllUsers -SkipDependencyCheck
Get-InstalledPSResource Microsoft.Graph* -Scope AllUsers | Where-Object { $_.Name -like "Microsoft.Graph.Beta*" } | Uninstall-PSResource -Scope AllUsers -SkipDependencyCheck

PSResourceGet vs. PowerShellGet v2

Let’s compare PSResourceGet and PowerShellGet v2 to see which one is faster at installing and removing modules.

In this example, we will use the Measure-Command cmdlet to install and uninstall the Microsoft Graph PowerShell module. It’s an excellent test because it has 39 modules.

PSResourceGet is much faster compared to PowerShellGet v2.

Cmdlets PSRecourceGet (version 1.0.2) PowerShellGet v2 (version 2.2.5)
Install-PSResource 58 seconds
Uninstall-PSResource 396 milliseconds
Install-Module 3 minutes and 14 seconds
Uninstall-Module 3 minutes and 48 seconds

That’s it!

Leave a Reply