Created
December 30, 2020 08:50
-
-
Save mpern/ae90b5841fd6a33307a4f12ea40e48be to your computer and use it in GitHub Desktop.
`choco upgrade` with auto-elevation (automatically run as Administrator)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (-not (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))) { | |
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`" `"$args`"" -Verb RunAs; exit | |
} | |
choco upgrade all -y; | |
Write-Host "`n`nPress any key to exit script..."; $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") > $null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment