From 5d88931b007ed90f8d7347939dfd5a78b6704d83 Mon Sep 17 00:00:00 2001 From: Paul Higinbotham Date: Thu, 5 Aug 2021 14:24:41 -0700 Subject: [PATCH] Add catch for unauthorized access when removing applocker test files --- src/System.Management.Automation/utils/PathUtils.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/System.Management.Automation/utils/PathUtils.cs b/src/System.Management.Automation/utils/PathUtils.cs index 991e3fa63b6..590c595554a 100644 --- a/src/System.Management.Automation/utils/PathUtils.cs +++ b/src/System.Management.Automation/utils/PathUtils.cs @@ -443,6 +443,10 @@ internal static bool TryDeleteFile(string filepath) { // file is in use on Windows } + catch (UnauthorizedAccessException) + { + // user does not have permissions + } } return false;