public/Test-IsAdmin.ps1

1
2
3
4
5

function Test-IsAdmin() {
    $principal = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent())
    return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
}