Set-MpPreference is a PowerShell cmdlet that changes Microsoft Defender Antivirus preferences on Windows. Administrators use it to set or clear security settings such as real-time protection, cloud-delivered protection, exclusions and behaviour monitoring, so it directly affects endpoint defence and the attack surface exposed to local administrative access.
What Microsoft Defender preference changes mean
Set-MpPreference changes the local configuration that Microsoft Defender Antivirus uses to decide what it scans, blocks and trusts. That makes it a high-impact administration command, because a legitimate change can alter detection coverage, while a malicious or careless change can create a quieter path for malware to run, persist or avoid inspection.
Because this cmdlet writes policy-like settings on the endpoint, it is most relevant on managed Windows systems where local administrators, automation, or software deployment tools can reach Defender settings. The security question is usually not whether the command exists, but who can run it and whether the resulting preferences are governed, monitored and expected.
Which Defender preferences are most security-sensitive
Set-MpPreference can affect several controls that materially change endpoint protection posture. Real-time protection and behaviour monitoring influence how quickly suspicious activity is stopped. Cloud-delivered protection and sample submission affect how quickly Defender can use cloud intelligence. Exclusions are especially sensitive because they can remove files, folders, processes or paths from inspection and can become an evasion mechanism if overused or broadened without review.
In practice, the most dangerous changes are often the quietest ones: a single exclusion, a reduced detection setting, or a feature toggle that weakens inspection without triggering an obvious failure. That is why the command should be treated as a security control surface, not as a routine convenience option.
How this command is abused or misused
Attackers who obtain local administrative access often look for ways to reduce endpoint visibility before staging payloads or moving laterally. Changing Defender preferences can help them do that by lowering detection sensitivity, suppressing cloud-assisted detection, or carving out exclusions for malicious binaries, scripts or working directories. Even when the change is temporary, it can be enough to complete an intrusion stage that would otherwise have been interrupted.
Benign misuse is also common. Administrators may add broad exclusions to fix perceived false positives, speed up installs, or support legacy software. Those exceptions can persist long after the original issue is gone, leaving a durable blind spot in the endpoint control set.
How organisations should evaluate and govern exposure
Exposure starts with knowing where Defender settings are being changed and by whom. Organisations should inventory managed Windows endpoints, identify which systems allow local administrative access, and determine whether preferences are set manually, through scripts, or by central management. Vendor guidance and local policy should be the first reference point when validating whether a given preference change is intentional or suspicious.
Change control matters here because the same cmdlet can be used for legitimate tuning or for defence suppression. The strongest governance model is one where baseline configuration is standardised, exceptions are approved, and deviations are visible enough to investigate quickly. For broader endpoint hardening and exclusion management, the Adware and Potentially Unwanted Programs Guide is a useful companion because it covers Defender PUA protection, browser policy and related block-and-detect decisions.
Practitioner actions after a preference change
Why practitioners should care: A preference change can be a normal tuning step or an attacker’s way to weaken endpoint defence, so the operational context matters as much as the setting itself. Review change origin, intended scope and duration whenever Defender behaviour shifts.
What to watch for: Unplanned exclusions, disabled real-time protection, reduced cloud protection, or repeated preference changes on the same endpoint should be treated as signals of either misconfiguration or active tampering. If the command is used in automation, the automation path should be as tightly controlled as the endpoint itself.
Practitioner takeaway: Treat Set-MpPreference as a privileged security-control interface, not a routine admin convenience, and verify that every non-default change has an owner, a purpose and a review path.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | CM-7 — Least Functionality | Set-MpPreference can weaken or narrow Defender functionality on an endpoint. |
| SI-3 — Malicious Code Protection | The cmdlet directly changes Microsoft Defender Antivirus protection behaviour. | |
| AU-12 — Audit Record Generation | Preference changes should be logged to support detection and review of endpoint defence tampering. | |
| Recommendation — Limit Defender setting changes to approved minimums and review any reduction in protection. Enforce and monitor malicious-code protection settings through approved baseline configuration. Generate and retain audit records for Defender configuration changes and investigate unexpected deltas. | ||
| CIS Controls v8 | CIS-10 — Malware Defenses | Defender preferences control malware detection, blocking and exclusions. |
| CIS-4 — Secure Configuration of Enterprise Assets and Software | The command changes security configuration on managed Windows endpoints. | |
| Recommendation — Standardize malware defense settings and restrict exclusions to documented business needs. Baseline Defender configuration and detect unauthorized preference drift across endpoints. | ||
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org