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

Welcome Forums General PowerShell Q&A How to upgrade powershell module 4.X to 5.X

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
3 months, 1 week ago.

  • Author
    Posts
  • #105820

    Participant
    Points: 1
    Rank: Member

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

  • #105826

    Participant
    Points: 175
    Helping Hand
    Rank: Participant

    Remote is a bit tricky.

    See here for the MSI installer for the appropriate OS. https://www.microsoft.com/en-us/download/details.aspx?id=54616

    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.

    • #107704

      Participant
      Points: 1
      Rank: Member

      Thank you would try and update you

       

  • #105829

    Participant
    Points: 225
    Helping Hand
    Rank: Participant

    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...

    https://docs.microsoft.com/en-us/powershell/wmf/5.0/productincompat

The topic ‘How to upgrade powershell module 4.X to 5.X’ is closed to new replies.