mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Added helper function to test for administrative shell
This commit is contained in:
parent
c509143433
commit
bfc1a973b2
1 changed files with 11 additions and 0 deletions
11
lib/core/tools/Test-AdministrativeShell.psm1
Normal file
11
lib/core/tools/Test-AdministrativeShell.psm1
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function Test-AdministrativeShell()
|
||||
{
|
||||
$WindowsPrincipcal = New-Object System.Security.Principal.WindowsPrincipal(
|
||||
[System.Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
);
|
||||
|
||||
if ($WindowsPrincipcal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
return $TRUE;
|
||||
}
|
||||
return $FALSE;
|
||||
}
|
||||
Loading…
Reference in a new issue