From 72157d3a7fe6a02b3db22c997cbb012396d763b7 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Fri, 26 Aug 2022 15:36:52 +0200 Subject: [PATCH] Fixes exception on update file removal --- lib/core/installer/tools/SetUpdatingIMC.psm1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/installer/tools/SetUpdatingIMC.psm1 b/lib/core/installer/tools/SetUpdatingIMC.psm1 index 76ae3e9..4bcbbbb 100644 --- a/lib/core/installer/tools/SetUpdatingIMC.psm1 +++ b/lib/core/installer/tools/SetUpdatingIMC.psm1 @@ -8,7 +8,9 @@ function Set-IcingaForWindowsManagementConsoleUpdating() $UpdateFile = Join-Path -Path (Get-IcingaCacheDir) -ChildPath 'framework.update'; if ($Completed) { - Remove-ItemSecure -Path $UpdateFile -Force -Retries 5 | Out-Null; + if (Test-IcingaForWindowsManagementConsoleUpdating) { + Remove-ItemSecure -Path $UpdateFile -Force -Retries 5 | Out-Null; + } } else { New-Item -Path $UpdateFile -ItemType File -Force | Out-Null; }