windows command for upgrade powershell version 2 to 5.1 code example
Example: upgrade powershell to 7.1.1 command line
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"