Skip to content

Instantly share code, notes, and snippets.

@TheEagleByte
Created September 21, 2017 13:13
Show Gist options
  • Save TheEagleByte/c7dd73a7102440e65a646bda5eefb1d8 to your computer and use it in GitHub Desktop.
Save TheEagleByte/c7dd73a7102440e65a646bda5eefb1d8 to your computer and use it in GitHub Desktop.
Administrator Check on Powershell
#
# 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