mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 15:19:58 -05:00
12 lines
481 B
PowerShell
12 lines
481 B
PowerShell
|
|
$AdminShell = New-Object -TypeName PSObject;
|
||
|
|
$AdminShell | Add-Member -membertype ScriptMethod -name 'IsAdminShell' -value {
|
||
|
|
$CurrentIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent();
|
||
|
|
$WindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($CurrentIdentity);
|
||
|
|
|
||
|
|
if (-Not $WindowsPrincipal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||
|
|
return $FALSE;
|
||
|
|
}
|
||
|
|
return $TRUE;
|
||
|
|
}
|
||
|
|
|
||
|
|
return $AdminShell;
|