Started getting the following error in VSCode recently:
I ran Get-Module -ListAvailable PackageManagement | fl
and saw I had an old PackageManagement v1.0.0.1 version installed
Problem was when I clicked to update the version, I was met with the following error that it could not resolve the PSGallery
This is because my system was behind a firewall and we are required to go thru Nexus proxy nuget repo for this stuff. To do that, I needed to run PowerShell as administrator and add our internal PSRepository
Register-PSRepository -Name Nexus-PowerShell -SourceLocation https://registry.devlesson.com/repository/nuget-powershell -PublishLocation https://registry.devlesson.com/repository/nuget-powershell -InstallationPolicy Trusted
Once that we done, I was able to find and install a newer copy of PackageManagement
Find-Module PackageManagement -Repository Nexus-Powershell | Install-Module -Scope AllUsers -AllowClobber
And finally, I went ahead and removed the older version. (Note: This has to be done in the right order. Make sure you have the new version installed first or you’ll encounter a message that find-module was found but could not be loaded.
Remove-Item 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1' -Recurse -Force