Our Blog

Update-Module : Module ‘PowershellGet’ was not installed by using Install-Module, so it cannot be updated.

When trying to fix PowerShellGet lack of AllowPrerelease Windows actually blocked me from updating PowerShellGet which I knew is the reason why it fails in first place.

Update-Module : Module ‘PowershellGet' was not installed by using Install-Module, so it cannot be updated.
At line:1 char:1
+ Update-Module PowershellGet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (PowershellGet:String) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : ModuleNotInstalledUsingInstallModuleCmdlet,Update-Module

How can I fix it?

This is because PowerShellGet comes builtin with Windows 2016 but it's on older version. If you want all bells and whistles you need to install newest version from PowerShellGallery.

PS C:\Windows\system32> Install-Module PowerShellGet
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 '1.6.7', run Instal
l-Module and add the -Force parameter, this command will install version '1.6.7' in side-by-side with version '1.0.0.1'.

PS C:\Windows\system32> Install-Module PowerShellGet -Force

Finally just restart PowerShell session and subsequent commands will work without an issue.

Tags: , ,

This is a unique website which will require a more modern browser to work! Please upgrade today!