Test-Driving PowerShellGet Version 3

by Jun 8, 2023

PowerShellGet is a module and contains important cmdlets such as Install-Module, so this module is really the prerequisite for downloading and installing any other module, i.e. from powershellgallery.com.

Finally, the long-awaited version 3 of this module is available as a preview at the PowerShell gallery, and there are many good reasons why you should use this new version.

This is how you can install it:

PS> Install-Module -Name PowerShellGet -AllowPrerelease -Scope CurrentUser 

One of the reasons why you should update is the fact that you may not even be able to do so anymore. Chances are your Install-Module cmdlet is missing the -AllowPrerelease parameter so you cannot install any prerelease modules. Same holds true for any modern module with a semantic versioning.

The sad truth is that PowerShellGet was included into the Windows 10/11 image in its initial version, and ever since was never automatically updated. Version by now is so outdated that it won’t work correctly in many scenarios anymore.

To work around this, you should first manually and forcefully install PowerShellGet 2.x. This installs the prerequisites you need to then install PowerShellGet 3.x:

PS> Install-Module -Name PowerShellGet -Scope CurrentUser -Force -AllowClobber 

Once you run this line and restart PowerShell, Install-Module now should have the -AllowPrelease parameter, so now you can run the first code line and install PowerShellGet 3.x.

Ultimately, PowerShellGet Version 3 will hopefully put an end to all of these issues and provide increased robustness for PowerShell’s module exchange mechanisms.

Tweet this Tip! Tweet this Tip!