diff --git a/lib/core/framework/Install-IcingaFrameworkUpdate.psm1 b/lib/core/framework/Install-IcingaFrameworkUpdate.psm1 index bce23d5..ee00576 100644 --- a/lib/core/framework/Install-IcingaFrameworkUpdate.psm1 +++ b/lib/core/framework/Install-IcingaFrameworkUpdate.psm1 @@ -57,6 +57,12 @@ function Install-IcingaFrameworkUpdate() return; } + $ServiceStatus = (Get-Service 'icingapowershell' -ErrorAction SilentlyContinue).Status; + + if ($ServiceStatus -eq 'Running') { + Stop-IcingaService 'icingapowershell'; + } + $NewDirectory = (Join-Path -Path $ModuleDirectory -ChildPath 'icinga-powershell-framework'); $ExtractDir = (Join-Path -Path $ModuleDirectory -ChildPath $Extracted); $BackupDir = (Join-Path -Path $ExtractDir -ChildPath 'previous'); @@ -95,5 +101,9 @@ function Install-IcingaFrameworkUpdate() Test-IcingaAgent; + if ($ServiceStatus -eq 'Running') { + Start-IcingaService 'icingapowershell'; + } + Write-Host 'Framework update has been completed'; }