mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 14:51:19 -05:00
19 lines
543 B
PowerShell
19 lines
543 B
PowerShell
function Get-IcingaServiceUser()
|
|
{
|
|
$Services = Get-IcingaServices -Service 'icinga2';
|
|
if ($null -eq $Services) {
|
|
$Services = Get-IcingaServices -Service 'icingapowershell';
|
|
if ($null -eq $Services) {
|
|
return $null;
|
|
}
|
|
}
|
|
|
|
$Services = $Services.GetEnumerator() | Select-Object -First 1;
|
|
$ServiceUser = ($Services.Value.configuration.ServiceUser).Replace('.\', '');
|
|
|
|
if ($ServiceUser -eq 'LocalSystem') {
|
|
$ServiceUser = 'NT Authority\SYSTEM';
|
|
}
|
|
|
|
return $ServiceUser;
|
|
}
|