Last active
June 8, 2022 17:28
-
-
Save wise-io/4fa3fc00274a45ffa6b9df1f92126abc to your computer and use it in GitHub Desktop.
Runs a Windows Defender Scan
This file contains 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
# Runs a Windows Defender Scan | |
param( | |
[ValidateSet('Full', 'Quick', 'Offline', IgnoreCase)] | |
[string]$Type = 'Quick', # Scan type (defaults to quick scan) | |
[System.IO.FileInfo]$Path # Optional local path to scan | |
) | |
# Format type parameter | |
$Type = (Get-Culture).TextInfo.ToTitleCase($Type) | |
# Update definitions | |
Update-MpSignature | |
# Run scan | |
if ($Path) { | |
Start-MpScan -ScanType 'Custom' -ScanPath $Path | |
} | |
elseif ($Type -eq 'Offline') { | |
Start-MpWDOScan | |
exit | |
} | |
else { | |
Start-MpScan -ScanType $Type | |
} | |
# Remove active threats | |
Remove-MpThreat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment