Created
October 19, 2022 03:21
-
-
Save marcinantkiewicz/9013d44f5e116d3d549a4a53a6031058 to your computer and use it in GitHub Desktop.
This file contains 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")){ | |
Write-Host "Not admin, elvevating" | |
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit | |
} | |
else { | |
Write-Host "I hate PS so, so much" | |
Start-Sleep -Second 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment