Skip to content

Commit cdd04c5

Browse files
committed
WIP
1 parent 6ce759c commit cdd04c5

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

lib/core/icingaagent/getters/Get-IcingaAgentInstallation.psm1

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,6 @@ function Get-IcingaAgentInstallation()
1818
}
1919
}
2020

21-
$IcingaService = Get-IcingaWindowsServiceStatus -Service 'icinga2';
22-
$ServiceUser = 'NT AUTHORITY\NetworkService';
23-
24-
if ($IcingaService.Present) {
25-
$ServiceUser = (Get-IcingaWindowsInformation Win32_Service |
26-
ForEach-Object {
27-
if ($_.Name -Like 'icinga2') {
28-
return $_;
29-
}
30-
} | Select-Object StartName).StartName;
31-
}
32-
3321
if ($null -eq $IcingaData) {
3422
return @{
3523
'Installed' = $FALSE;
@@ -38,7 +26,7 @@ function Get-IcingaAgentInstallation()
3826
'Architecture' = $architecture;
3927
'Uninstaller' = '';
4028
'InstallDate' = '';
41-
'User' = $ServiceUser;
29+
'User' = (Get-IcingaServiceUser);
4230
};
4331
}
4432

@@ -49,6 +37,6 @@ function Get-IcingaAgentInstallation()
4937
'Architecture' = $architecture;
5038
'Uninstaller' = $IcingaData.UninstallString.Replace("MsiExec.exe ", "");
5139
'InstallDate' = $IcingaData.InstallDate;
52-
'User' = $ServiceUser;
40+
'User' = (Get-IcingaServiceUser);
5341
};
5442
}

lib/core/icingaagent/getters/Get-IcingaServiceUser.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function Get-IcingaServiceUser()
88
if ($Services.Present -eq $FALSE) {
99
$Services = Get-IcingaWindowsServiceStatus -Service 'icingapowershell';
1010
if ($Services.Present -eq $FALSE) {
11-
return $null;
11+
return 'NT Authority\NetworkService';
1212
}
1313
}
1414

0 commit comments

Comments
 (0)