Last active
November 10, 2017 16:13
-
-
Save RobsonAutomator/0d5fa2030da0572953595d966dc735b7 to your computer and use it in GitHub Desktop.
Check if current user has administrator rights
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-Warning -Message "Please run this script with Administrator rights" | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment