Skip to content

Instantly share code, notes, and snippets.

@numbnet
Created May 2, 2021 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numbnet/c70f849ae7e913159a6b3217e7ec6627 to your computer and use it in GitHub Desktop.
Save numbnet/c70f849ae7e913159a6b3217e7ec6627 to your computer and use it in GitHub Desktop.
if ((Get-WmiObject win32_operatingsystem | select osarchitecture).osarchitecture -like "64*")
{
Write "... for Windows x64"
$OSx = 'x64'
} else {
Write "... for Windows x86"
$OSx = 'x86'
}
$FileName = "PowerShell-7.2.0-preview.5-win-$OSx.msi"
$DirLoad = "PS\PowerShell"
$DownLink = "https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.5/PowerShell-7.2.0-preview.5-win-$OSx.msi"
New-Item -Path "$env:SYSTEMDRIVE\" -Name "$DirLoad" -ItemType Directory
Invoke-WebRequest -Uri "$DownLink" -OutFile "$env:SYSTEMDRIVE\$DirLoad\$FileName"
start "$env:SYSTEMDRIVE\$DirLoad\$FileName"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment