Created
January 18, 2018 02:51
-
-
Save chrisbrownie/f95b5bf8b00516238f0651cd0d1b2aca to your computer and use it in GitHub Desktop.
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
# Check for Administrator elevation | |
$wid = [System.Security.Principal.WindowsIdentity]::GetCurrent() | |
$prp = new-object System.Security.Principal.WindowsPrincipal($wid) | |
$adm = [System.Security.Principal.WindowsBuiltInRole]::Administrator | |
$IsAdmin = $prp.IsInRole($adm) | |
if ($IsAdmin) { | |
$Host.UI.RawUI.BackgroundColor = "DarkRed" | |
Clear-Host | |
Write-Host "`n`tWarning: PowerShell is running as an Administrator.`n" | |
} | |
else { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment