guide · static export
Security · security

Run an Offline Defender Scan on a Machine That Will Not Stay Clean

When malware comes back after every cleaning, the scanner has to run before Windows starts. Update signatures, reboot into the offline scan, and check afterwards what was turned off.

by@guidox updated:10/31/26 time:30 min level:Intermediate tested on:Windows 11 24H2 works on:Windows 10, Windows 11 tools:PowerShell as administrator, Windows Security
TL;DR

Update signatures with **MpCmdRun -SignatureUpdate**, run **Start-MpWDOScan** for the boot-time scan, then read **Get-MpThreatDetection** and re-enable whatever the malware disabled.

Before you start

Requirements

  • Admin rights
  • Windows Security active
  • 30 minutes
Step by step

Instructions

01

Update the signatures first

An offline scan with stale definitions finds nothing. Resolve the current **Platform** folder instead of hard-coding a version number, because it changes with every update.

$mp = Get-ChildItem 'C:\ProgramData\Microsoft\Windows Defender\Platform' -Directory |
  Sort-Object Name -Descending | Select-Object -First 1
$mpcmd = Join-Path $mp.FullName 'MpCmdRun.exe'
& $mpcmd -SignatureUpdate
02

Run a full scan with the console

**-ScanType 2** is the full scan and runs while you keep working. The output shows the path of anything it quarantines, which is often more useful than the summary.

& $mpcmd -Scan -ScanType 2
Get-MpComputerStatus | Select-Object AntivirusSignatureLastUpdated,FullScanEndTime,RealTimeProtectionEnabled
03

Start the offline scan

The offline scan reboots the machine and runs outside Windows, so nothing resident can hide. Give it an hour on a laptop, plugged in, and do not interrupt it.

Start-MpWDOScan
:: equivalent from the UI: Windows Security > Virus & threat protection > Scan options > Microsoft Defender Antivirus (offline scan)
⚠ warningThe machine reboots on its own and shows a progress screen. Cutting the power during this pass can leave the boot configuration confused.
04

Read what was found and where

**Get-MpThreatDetection** lists each detection with the file and the action taken. That path tells you which application is compromised and which files to replace.

Get-MpThreatDetection | Sort-Object InitialDetectionTime -Descending |
  Select-Object -First 10 InitialDetectionTime,ThreatID,Resources
Get-MpThreat | Select-Object ThreatName,SeverityID,IsActive
05

Check what the malware switched off

Most infections disable protection or add exclusions so the scanner skips their folder. Read both settings before you call the machine clean.

Get-MpPreference | Select-Object DisableRealtimeMonitoring,ExclusionPath,ExclusionExtension,ExclusionProcess
Get-MpComputerStatus | Select-Object IsTamperProtected,AntivirusEnabled,RealTimeProtectionEnabled
06

Restore protection and verify

Remove the planted exclusions, turn real-time protection back on and confirm the state from a second source. A machine that reports protection off twice is not fixed.

Remove-MpPreference -ExclusionPath 'C:\Users\Public\Temp'
Set-MpPreference -DisableRealtimeMonitoring $false
Get-MpComputerStatus | Select-Object AntivirusEnabled,RealTimeProtectionEnabled,IsTamperProtected
tipIf tamper protection blocks your change, turn it back on in Windows Security first — malware disables it precisely so you cannot re-enable protection.
Troubleshooting

Common issues

Start-MpWDOScan does nothing

Another antivirus is registered, or Defender is disabled by policy. Check Get-MpComputerStatus for AntivirusEnabled and look for a third-party security product.

The offline scan loops back to the same screen

The recovery environment is damaged. Repair the recovery environment first, then repeat the scan.

Settings revert after a reboot

A policy or a scheduled task restores the malware's configuration. Check the local group policy and the Task Scheduler for entries you did not create.

The scan finds the same file every day

Something recreates it. Find the parent process in the detection event, and remove the scheduled task or service that drops the file.

FAQ

Frequently asked

Is the offline scan safe for my files?

It only reads and quarantines. Still keep a backup, because a false positive can quarantine a file you need.

Do I need a second opinion scanner?

After a real infection, yes. A single engine misses things, and a portable scanner does not need installation on a suspect machine.

How to undo this

The offline scan leaves no setting behind. Undo manual changes with Set-MpPreference -DisableRealtimeMonitoring $false and remove exclusions with Remove-MpPreference; quarantined files can be restored from Windows Security > Protection history.

Changelog · 1 entry
  1. 2026-10-31
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress