From 496d985c0109630c072db63ef88d2ddab46e5924 Mon Sep 17 00:00:00 2001 From: itm4n <30777390+itm4n@users.noreply.github.com> Date: Sun, 14 Dec 2025 16:42:52 +0100 Subject: [PATCH] Fix improper handling of read access errors on WMI object db file due to EDR denying access (issue #81) --- info/CHANGELOG.md | 1 + src/helper/Environment.ps1 | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/info/CHANGELOG.md b/info/CHANGELOG.md index 9be8730..e7518dd 100644 --- a/info/CHANGELOG.md +++ b/info/CHANGELOG.md @@ -6,6 +6,7 @@ - False positive in IPv6 configuration check. - Improved handling of AppId and TypeLibId values when enumerating COM, so that parsing errors are properly handled and reported with warning messages (issue #78). +- Errors caused by EDR denying access to the WMI object database file are now properly handled (issue #81). ## 2025-11-19 diff --git a/src/helper/Environment.ps1 b/src/helper/Environment.ps1 index 8bead78..02e5f46 100644 --- a/src/helper/Environment.ps1 +++ b/src/helper/Environment.ps1 @@ -774,6 +774,12 @@ function Get-SccmNetworkAccessAccountCredential { if (-not $SanityCheck) { return } + $ReadAccess = Get-ObjectAccessRight -Name $Path -Type File -AccessRights @($script:FileAccessRight::ReadData) + if ($null -eq $ReadAccess) { + Write-Warning "Read access to file is not allowed: $($Path)" + return + } + $Candidates = Select-String -Path $Path -Pattern "$($BasePattern)`0`0$($PolicyPatternBegin)" if ($null -eq $Candidates) { return }