Here you always find a fun code snippet that gets you immediate results. Use it as-is, or dive deeper and learn more about it. Featured Content will change regularly. Take a look at the Articles menu to view other topics and articles, or simply enter one or more search terms into out search bar to browse our archives.
$wid = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$prp = New-Object System.Security.Principal.WindowsPrincipal($wid)
$adm = [System.Security.Principal.WindowsBuiltInRole]::Administrator
Tests whether you currently have Admin privileges or not