Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update powershell to the latest revision

Tags:

powershell

I have two different revision of PowerShell in different machines. The local one have the following one:

Major Minor Build Revision
5 1 17763 1007

And the virtual machine has the following one:

Major Minor Build Revision
5 1 17763 771

As you can see that it has the same: Major, Minor, and Build values except the Revision values. I am not sure if it is behind the failure of the command:

Register-PSRepository -Name $RepoKeyName -SourceLocation $RepoKeyValue
    -PublishLocation $RepoKeyValue -InstallationPolicy Trusted -Verbose

The above snippet works fine on the local machine but not on the virtual machine and it fails in the virtual machine with the following error:

parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.

And this is why I want to update the PowerShell in the virtual machine to the latest revision value. How to do it?

like image 474
sajis997 Avatar asked Mar 04 '20 11:03

sajis997


People also ask

How do I upgrade to latest PowerShell?

If you need to update your existing version of PowerShell, in Windows, use the following table to locate the installer for the version of PowerShell you want to update to. On the initial release of Windows 10, with automatic updates enabled, PowerShell gets updated from version 5.0 to 5.1.

Is there a PowerShell command to update PowerShell?

On computers that have both Windows PowerShell 2.0 and Windows PowerShell 3.0, use the Update-Help cmdlet in a Windows PowerShell 3.0 session to download and update help files.


1 Answers

If you have Microsoft's winget app (Windows package manager), you can run the following command to update to the most recent version of PowerShell:

winget install Microsoft.PowerShell
like image 188
GaTechThomas Avatar answered Sep 21 '22 15:09

GaTechThomas