Skip to content

Commit f47c5d2

Browse files
committed
Attempt to handle exceptions thrown by Get-MpPreference (issue #83)
1 parent 29711f9 commit f47c5d2

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

info/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88

99
### Modified
1010

11-
- Refactor the BitLocker check to get its actual status on the system drive and thus eliminate false positives (issue #84).
11+
- Refactor the BitLocker check to get its actual status on the system drive and thus resolve false positives (issue #84).
12+
13+
### Fixed
14+
15+
- Attempt to handle exceptions thrown by Get-MpPreference (issue #83).
1216

1317
## 2026-01-30
1418

src/check/Configuration.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ function Invoke-DefenderForEndpointConfigurationCheck {
857857
$Result | Add-Member -MemberType "NoteProperty" -Name "MsSenseDllVersion" -Value $MsSenseDllVersion
858858
$Result | Add-Member -MemberType "NoteProperty" -Name "ConfigurationVersion" -Value $ConfigurationVersion
859859

860-
$MpPreference = Get-MpPreference
860+
$MpPreference = Get-MpPreference -ErrorAction SilentlyContinue
861861
if ($MpPreference) {
862862
$RealtimeMonitoringEnabled = -not $MpPreference.DisableRealtimeMonitoring
863863
$BehaviorMonitoringEnabled = -not $MpPreference.DisableBehaviorMonitoring

0 commit comments

Comments
 (0)