Run a Microsoft Defender scan from the command line
Kick off quick, full, custom, or offline boot scans with PowerShell or the MpCmdRun.exe utility — no GUI clicking required.
01Command
$ Start-MpScan -ScanType QuickScan02What it does
Start-MpScan is the PowerShell front-end for the Defender engine and runs synchronously, so the prompt blocks until the scan finishes. The classic alternative is Defender's native CLI: `"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 1` (quick), `-ScanType 2` (full), or `-ScanType 3 -File "D:\folder"` (custom path), plus `-Scan -ScanType 3 -File <path> -DisableRemediation` for detect-only runs. For malware that survives a normal boot, use a Microsoft Defender Offline scan via Windows Security > Virus & threat protection, since it runs before Windows loads. Results and history appear with `Get-MpThreatDetection` and `Get-MpThreat`.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Start-MpScan | Microsoft LearnEvidence: Microsoft documents Start-MpScan with -ScanType values QuickScan, FullScan, CustomScan and CpuScanLimit for Microsoft Defender scans.
- Configure and run scans with mp_cmdrun.exe | Microsoft LearnEvidence: Microsoft documents the MpCmdRun.exe command-line tool with -Scan -ScanType 1/2/3 parameters for running quick, full and custom scans.
Last verified: 2026-09-17 · Category: Security & Privacy
06Related solutions
Use the System File Checker to verify every protected Windows system file against known-good copies and automatically replace the damaged ones.
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.
Use the Deployment Image Servicing and Management tool to detect and repair corruption in the Windows component store, the layer SFC depends on.