It’s Wednesday already, is that good or bad for you? Hoping it’s a good thing, and hoping todays one-liner makes it even better.
$Path = $env:TEMP; $Installer = 'chrome_installer.exe'; Invoke-WebRequest -Uri 'http://dl.google.com/chrome/install/375.126/chrome_installer.exe' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args '/silent /install' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer
What this one-liner will do is go out and fetch chrome and silently install or update it. Then it will delete the installer after it has been installed. You could add lines for logging in case you had other software that you wanted to install after, but I feel this is a great foundation if you’ve never done it before. If you start adding logging and other features(ie. confirming it has installed), I’d definitely take it out of the one-liner format for ease of reading/troubleshooting unless for some reason you need to keep it as a one-liner.
You can do this with many applications, you just have to make sure the URI and switches(Args) are correct.
Drew McClellan says
Nice, thanks for the share!
I have really been enjoying Winget. Lots of pre-built manifests constantly updated and those unattended installers. Depending on the program’s installer, uninstalls may vary but 98% of all the installers have silent unattended uninstalls as well. Started making some packs from their pre-fabed manifests.
https://github.com/XXLMandalorian013/PowerShellScripts/blob/main/LocalScripts/Installers/WinGet/Installers/Chrome/Chrome.ps1
ClaytonT says
Awesome Drew!