Created
September 21, 2017 13:13
-
-
Save TheEagleByte/c7dd73a7102440e65a646bda5eefb1d8 to your computer and use it in GitHub Desktop.
Administrator Check on Powershell
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
# | |
# Check if Running as Administrator | |
# | |
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
{ | |
throw "ERROR: Run as Administrator." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment