Last active
November 24, 2024 20:43
-
-
Save tmap/e21731e1d0b2baa976e9c35aa7cbe234 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$mpCmdRunPath = "C:\Program Files\Windows Defender\MpCmdRun.exe" | |
$directories = Get-ChildItem -Path C:\ -Directory -recurse -ErrorAction SilentlyContinue | |
foreach ($directory in $directories) { | |
$dirPath = $directory.FullName | |
try { | |
$output = & $mpCmdRunPath -Scan -ScanType 3 -File "$dirPath\*" 2>$null | |
if ($output -match "Scanning .* was skipped") { | |
Write-Output "EXCLUDED: $dirPath" | |
} | |
} catch { | |
continue | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment