Fixes exception on update file removal

This commit is contained in:
Lord Hepipud 2022-08-26 15:36:52 +02:00
parent 1b3a12597a
commit 72157d3a7f

View file

@ -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;
}