Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created August 11, 2017 09:20
Show Gist options
  • Save johnmmoss/cb833726ba80b8d280cea609bfa6cc1e to your computer and use it in GitHub Desktop.
Save johnmmoss/cb833726ba80b8d280cea609bfa6cc1e to your computer and use it in GitHub Desktop.
$currentPsVersion = (get-host).Version.Major;
if ((get-host).Version.Major -ge 4) {
write-host Powershell version $currentPsVersion is already installed -ForegroundColor Red
return;
}
$ps4DownloadUrl = "http://download.microsoft.com/download/3/D/6/3D61D262-8549-4769-A660-230B67E15B25/Windows6.1-KB2819745-x64-MultiPkg.msu"
$ps4LocalPath = "$env:temp\ps4.msu"
$wusaPath = "$env:windir\System32\wusa.exe"
((New-Object System.Net.WebClient).DownloadFile($ps4DownloadUrl, $ps4LocalPath))
$command = "$wusaPath $ps4LocalPath /quiet /norestart"
iex ($command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment