diff --git a/Updater/Update-Service.ps1 b/Updater/Update-Service.ps1 index 26c4c2a4a38c7eeff7b39116614713eda3a19b9c..85e326261aa99e8a3a6bb46f76dec9ff7647c231 100644 --- a/Updater/Update-Service.ps1 +++ b/Updater/Update-Service.ps1 @@ -87,11 +87,20 @@ function Create-TrayAppStartupShortcut() { function Exit-IfDirMissing([string]$DirName, [string]$Desc) { - if (Test-Path -PathType Container $DirName) { - Write-Verbose "Verified $($Desc) path: [$($DirName)]" - Return + try { + if (Test-Path -PathType Container $DirName) { + Write-Verbose "Verified $($Desc) path: [$($DirName)]" + Return + } + } + catch { + $exmsg = $($_.Exception.Message) + } + $msg = "Failed checking $($Desc) path [$($DirName)]" + if ($exmsg.Length -gt 0){ + $msg += ":`n$($exmsg)" } - $msg = "ERROR: can't find / access $($Desc) path: [$($DirName)]" + Log-Error $msg Send-MailReport -Subject "path or permission error" -Body $msg Exit }