Skip to content

Instantly share code, notes, and snippets.

@DanielSmon
Last active July 11, 2022 23:52
Show Gist options
  • Save DanielSmon/05a0dd4d5d5861524c3d1e08e3a0f010 to your computer and use it in GitHub Desktop.
Save DanielSmon/05a0dd4d5d5861524c3d1e08e3a0f010 to your computer and use it in GitHub Desktop.
Function Test-Administrator
{
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment