mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Merge pull request #553 from Icinga:fix/exception_for_service_recovery_for_uninstalled_services
Fix: Exception for service recovery if service was not installed Fixes an exception caused by service recovery setting, if the required service was not installed before.
This commit is contained in:
commit
0756b47128
3 changed files with 5 additions and 4 deletions
|
|
@ -22,6 +22,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
* [#524](https://github.com/Icinga/icinga-powershell-framework/issues/524) Fixes uninstallation process by improving the location handling of PowerShell instances with Icinga IMC or Shell
|
||||
* [#545](https://github.com/Icinga/icinga-powershell-framework/issues/545) Fixes `RemoteSource` being cleared within repository `.json` files during `Update-IcingaRepository` tasks
|
||||
* [#552](https://github.com/Icinga/icinga-powershell-framework/pull/552) Fixes file encoding for Icinga for Windows v1.10.0 to ensure the cache is always properly created with the correct encoding
|
||||
* [#553](https://github.com/Icinga/icinga-powershell-framework/pull/553) Fixes an exception caused by service recovery setting, if the required service was not installed before
|
||||
|
||||
### Enhancements
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
function Disable-IcingaServiceRecovery()
|
||||
{
|
||||
if ($null -ne (Get-Service 'icinga2')) {
|
||||
if ($null -ne (Get-Service 'icinga2' -ErrorAction SilentlyContinue)) {
|
||||
$ServiceStatus = Start-IcingaProcess -Executable 'sc.exe' -Arguments 'failure icinga2 reset=0 actions=none/0/none/0/none/0';
|
||||
|
||||
if ($ServiceStatus.ExitCode -ne 0) {
|
||||
|
|
@ -10,7 +10,7 @@ function Disable-IcingaServiceRecovery()
|
|||
}
|
||||
}
|
||||
|
||||
if ($null -ne (Get-Service 'icingapowershell')) {
|
||||
if ($null -ne (Get-Service 'icingapowershell' -ErrorAction SilentlyContinue)) {
|
||||
$ServiceStatus = Start-IcingaProcess -Executable 'sc.exe' -Arguments 'failure icingapowershell reset=0 actions=none/0/none/0/none/0';
|
||||
|
||||
if ($ServiceStatus.ExitCode -ne 0) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
function Enable-IcingaServiceRecovery()
|
||||
{
|
||||
if ($null -ne (Get-Service 'icinga2')) {
|
||||
if ($null -ne (Get-Service 'icinga2' -ErrorAction SilentlyContinue)) {
|
||||
$ServiceStatus = Start-IcingaProcess -Executable 'sc.exe' -Arguments 'failure icinga2 reset=0 actions=restart/0/restart/0/restart/0';
|
||||
|
||||
if ($ServiceStatus.ExitCode -ne 0) {
|
||||
|
|
@ -10,7 +10,7 @@ function Enable-IcingaServiceRecovery()
|
|||
}
|
||||
}
|
||||
|
||||
if ($null -ne (Get-Service 'icingapowershell')) {
|
||||
if ($null -ne (Get-Service 'icingapowershell' -ErrorAction SilentlyContinue)) {
|
||||
$ServiceStatus = Start-IcingaProcess -Executable 'sc.exe' -Arguments 'failure icingapowershell reset=0 actions=restart/0/restart/0/restart/0';
|
||||
|
||||
if ($ServiceStatus.ExitCode -ne 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue