Run a Windows Defender scan via command line
Windows Defender Antivirus has a command line utility.
"C:\Program Files\Windows Defender\MpCmdRun.exe" -scan -scantype 1
Scan types:
1 | quick scan |
2 | full scan |
3 | custom file/directory scan (must specify a path via the -File parameter) |
Other interesting parameters:
-Restore -ListAll
list all items that were quarantined-SignatureUpdate
runs signature updates
-?
lists all of the available options.
PowerShell also makes available the following equivalent cmdlets (among others):
Start-MpScan
(the-ScanType
parameter is also required)Start-MpWDOScan
(runs before the OS loads; requires a restart; more info)Get-MpThreat
Update-MpSignature
The two scanning cmdlets can also be run as jobs by passing the -AsJob
switch.