How to upgrade powershell module 4.X to 5.X

Is there a way to upgrade powershell version from4.X to 5.1 remotely? I have 300+ servers that needs to be upgraded.

Remote is a bit tricky.

See here for the MSI installer for the appropriate OS.

With that, you should be able to do a silent install. Do note that it will not complete until a reboot; the day you do this, you may want to schedule a late-night restart domain-wide or something of that nature.

$Computers = Get-Content -Path '.\ServerList.txt'
$MsiLocation = '\\server\share\WMF5.1.msi'
Invoke-Command -ComputerName $Computers -ScriptBlock {
    Start-Process -NoNewWindow -FilePath 'msiexec.exe' -ArgumentList ('/a "{0}"' -f $MsiLocation), '/qn', '/norestart'

Feel free to use the ‘/forcerestart’ switch if you don’t mind taking those servers down for 10-15mins following the installation to get the new version of PS sorted out.

You could do a batch job like this early morning or something and have it all ready by the time everyone gets to work in the morning.

This is OK for client systems, but be sure to read the docs for version impacts on say Exchange, System Center, etc… versions. For example…

Thank you would try and update you