$currentPrincipal = New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent()) $administratorsRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator if (!$currentPrincipal.IsInRole($administratorsRole)) { Throw "This script must be run in an elevated session." }
No comments:
Post a Comment