PowerShellで管理者以外のスクリプト実行をはじく
from
PowerShell
PowerShell
で管理者以外のスクリプト実行をはじく
code:powershell
if (!(
Security.Principal.WindowsPrincipal
Security.Principal.WindowsIdentity
::GetCurrent()).IsInRole(
Security.Principal.WindowsBuiltInRole
::Administrator)) {
throw "This PowerShell script needs to be executed by an account with priviledges."
}