Skip to content

Instantly share code, notes, and snippets.

@stanionascu
Created March 22, 2020 12:03
Show Gist options
  • Save stanionascu/d505fc4762a4ab070bbf0a481be488ec to your computer and use it in GitHub Desktop.
Save stanionascu/d505fc4762a4ab070bbf0a481be488ec to your computer and use it in GitHub Desktop.
Install MS Edge via PowerShell
$LocalTempDir = $env:TEMP;
$EdgeInstaller = "MSEdgeInstaller.exe";
(new-object System.Net.WebClient).DownloadFile('https://c2rsetup.officeapps.live.com/c2r/downloadEdge.aspx?ProductreleaseID=Edge&platform=Default&version=Edge&source=EdgeStablePage&Channel=Stable&language=en', "$LocalTempDir\$EdgeInstaller");
& "$LocalTempDir\$EdgeInstaller" /silent /install;
$Process2Monitor = "MSEdgeInstaller";
Do {
$ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name;
If ($ProcessesFound) {
"Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2
} else {
rm "$LocalTempDir\$EdgeInstaller" -ErrorAction SilentlyContinue -Verbose
}
} Until (!$ProcessesFound)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment