Internal/Generic/Test-Administrator.ps1

1
2
3
4
5
#Requires -Version 5.0

function Test-Administrator {
    return (New-Object -TypeName Security.Principal.WindowsPrincipal -ArgumentList ([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}