Hello
Restart-IcingaForWindows doesn’t work because the host process for winrm plugins cannot be ended.
Hello
Restart-IcingaForWindows doesn’t work because the host process for winrm plugins cannot be ended.
Hello
Thank you for your message. Is the server installed on the machine?
Get-Service icingapowershell;
In case it does, can you please share the following outout:
(Get-IcingaServices 'icingapowershell').icingapowershell | ConvertTo-Json;
Hello @cstein
that is the output
PS C:\Users\user> Get-Service icingapowershell;
Status Name DisplayName
------ ---- -----------
Running icingapowershell Icinga PowerShell Service
PS C:\Users\user> (Get-IcingaServices 'icingapowershell').icingapowershell | ConvertTo-Json;
{
"metadata": {
"ServiceHandle": null,
"DisplayName": "Icinga PowerShell Service",
"Depends": null,
"ServiceName": "icingapowershell",
"Container": null,
"Site": null,
"Dependent": null
},
"configuration": {
"CanPauseAndContinue": true,
"CanStop": true,
"ServiceUser": "serviceuser@domain",
"ServiceType": {
"value": 16,
"raw": 16
},
"StartType": {
"value": "Automatic",
"raw": 2
},
"ServicePath": "\"C:\\Program Files\\icinga-framework-service\\icinga-service.exe\" \"C:\\Program Files\\WindowsPowerShell\\Modules\\icinga-powershell-framework\\icinga-powershell-framework.psd1\"",
"CanShutdown": true,
"ServiceHandle": null,
"Status": {
"value": 4,
"raw": 4
},
"ExitCode": 0
}
}
Mh, this is weird. Just out of curiosity: Did you run the PowerShell as administrator?
I have now started a PowerShell with psexec -i -s powershell
.
This means that the PowerShell is no longer only executed with my administrator account but with user SYSTEM. Then it works without any problems.
This is also possible with a Windows task that runs under SYSTEM, optionally with subsequent removal of the task:
PowerShell
$actionArgument = "-Command &{Update-Icinga -Confirm}"
$action = New-ScheduledTaskAction -Execute powershell -Argument $actionArgument
$principal = New-ScheduledTaskPrincipal -UserId SYSTEM
$task = New-ScheduledTask -Action $action -Principal $principal
$regTask = $task | Register-ScheduledTask IcingaForWindowsUpdate
$regTask | Start-ScheduledTask
#$regTask | Unregister-ScheduledTask -Confirm:$false