0

How to Get Newer Version of PowerShellGet – Install, Don’t Upgrade

Current versions of Windows come with a version of PowerShellGet pre-installed.  The PowerShellGet and PackageManagement modules originally were released in Windows PowerShell 5.0 which itself was part of the Windows Management Framework (WMF) 5.0 RTM.  This was back in early 2016. The PowerShellGet module is also integrated with the PackageManagement module as a provider.

The 1.0.0.1 version of PowerShellGet has limited functionality and must be updated to work properly with the PowerShell Gallery. To be supported, you must update to the latest version.

This version information can be seen on the below machine by running the Get-Module command.  The updated PowerShellGet module is located on the public PowerShell Gallery which is not trusted by default.  Note that with improvments to security you will need to use a a supported TLS version to connect to the gallery.  If not then you will run into issues such as this if you try and rock the TLS 1.0 protocol.

Get-Module PowerShellGet -ListAvailable

Initial Version of PowerShellGet

 

Unable To Update Initial Version of PowerShellGet Using Update-Module

Since this initial version of PowerShellGet was pre-isntalled, it can not simply be updated.  If you try, then it will fail.

This is shown below.

Update-Module PowerShellGet
Update-Module PowerShellGet -Force

image

Update-Module : Module 'PowerShellGet' was not installed by using Install-Module, so it cannot be updated.

 

Use The Force - Along With Install-Module

The correct way to "update" the built-in version is to use Install-Module.

If you do not add -Force then you'll get some yellow text.

Install-Module -PowerShellGet

image

WARNING: Version '1.0.0.1' of module 'PowerShellGet' is already installed at 'C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1'. To install version '2.2.5', run Install-Module and add the
-Force parameter, this command will install version '2.2.5' in side-by-side with version '1.0.0.1'.

 

Install-Module -PowerShellGet -Force

image

 

Module Updated

Now that we have updated the module, not that there is an additional version overand above the 1.0.0.1 initial version.

 

image

Cheers,
Rhoderick

Rhoderick Milne [MSFT]

Leave a Reply

Your email address will not be published. Required fields are marked *