Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions lib/diagnostic.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,26 @@ Use 'warn' to highlight the issue, and follow up with the recommended actions to
function check_windows_defender($global) {
$defender = Get-Service -Name WinDefend -ErrorAction SilentlyContinue
if (Test-CommandAvailable Get-MpPreference) {
if ((Get-MpPreference).DisableRealtimeMonitoring) { return $true }
if ($defender -and $defender.Status) {
if ($defender.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {
$installPath = $scoopdir;
if ($global) { $installPath = $globaldir; }
try {
if ((Get-MpPreference -Erroraction Stop).DisableRealtimeMonitoring) { return $true }
if ($defender -and $defender.Status) {
if ($defender.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {
$installPath = $scoopdir;
if ($global) { $installPath = $globaldir; }

$exclusionPath = (Get-MpPreference).ExclusionPath
if (!($exclusionPath -contains $installPath)) {
info "Windows Defender may slow down or disrupt installs with realtime scanning."
Write-Host " Consider running:"
Write-Host " sudo Add-MpPreference -ExclusionPath '$installPath'"
Write-Host " (Requires 'sudo' command. Run 'scoop install sudo' if you don't have it.)"
return $false
$exclusionPath = (Get-MpPreference -Erroraction Stop).ExclusionPath
if (!($exclusionPath -contains $installPath)) {
info "Windows Defender may slow down or disrupt installs with realtime scanning."
Write-Host " Consider running:"
Write-Host " sudo Add-MpPreference -ExclusionPath '$installPath'"
Write-Host " (Requires 'sudo' command. Run 'scoop install sudo' if you don't have it.)"
return $false
}
}
}
} catch [Microsoft.Management.Infrastructure.CimException] {
debug "Get-MpPreference failed: $($_.Exception.Message)"
return $true
}
}
return $true
Expand Down