Created
January 29, 2018 18:34
-
-
Save lorengordon/7100b00e4d02518cdbacbcb0bf4f9706 to your computer and use it in GitHub Desktop.
Powershell profile with admin check
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 "Skipping functions that require elevated permissions..." | |
} | |
else | |
{ | |
# Do admin stuff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment