function Get-IsAdministrator { $Identity = [System.Security.Principal.WindowsIdentity]::GetCurrent() $Principal = New-Object System.Security.Principal.WindowsPrincipal($Identity) $Principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator) } function Get-IsUacEnabled { (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System).EnableLua -ne 0 }