/
/

How to Add or Remove Windows Security in the Desktop Context Menu in Windows 11

by Mikhail Blacer, IT Technical Writer
How to Add or Remove Windows Security in the Desktop Context Menu in Windows 11 blog banner image

Instant Summary

This NinjaOne blog post offers a comprehensive basic CMD commands list and deep dive into Windows commands with over 70 essential cmd commands for both beginners and advanced users. It explains practical command prompt commands for file management, directory navigation, network troubleshooting, disk operations, and automation with real examples to improve productivity. Whether you’re learning foundational cmd commands or mastering advanced Windows CLI tools, this guide helps you use the Command Prompt more effectively.

Key Points

  • Add Windows Security via Registry Entries: Create shell keys under HKCR to add a Windows Security shortcut to the desktop context menu.
  • Enable On-Demand Scans from Explorer: Add “Scan with Windows Security” to the file context menu by configuring the proper registry path and Defender scan commands.
  • Deploy and Enforce at Scale: Use .reg files and PowerShell scripts through RMM/MDM tools to apply or remove Windows Security shortcuts consistently across endpoints.
  • Validate Launch and Scan Behavior: Test added entries to confirm Windows Security opens correctly, and Defender completes scans without errors.
  • Document Registry Paths and Deployment Steps: Record key locations, script usage, and verification procedures to prevent drift and support audits.

Windows Security handles all aspects of protection. It centralizes antivirus, firewall, and device protection controls. However, accessing it via the Start menu or taskbar slows workflows down. An option is to have critical tools in the right-click desktop context menu to speed things up, streamlining daily checks during troubleshooting.

This guide shows how to add Windows Security to the context menu in Windows 11, remove it when needed, and verify that the right-click entry opens the correct dashboard. It covers registry edits, optional scripted deployment, and validation steps suitable for standalone devices and managed environments.

Ways to add Windows Security to the context menu in Windows 11

Adding Windows Security to the right-click context menu requires the following:

📌 Prerequisites:

  • You will need a Windows 11 device with administrative privileges.
  • This needs permission to edit HKCR and HKLM registry paths.
  • You will need to have Windows Security (Windows Defender) enabled on the system.
  • This requires the optional use of PowerShell or .reg files if you plan to script deployment.

📌 Recommended deployment strategies:

Click to Choose a Method

💻

Best for Individual Users

💻💻💻

Best for Enterprises

Method 1: Via custom registry entry
Method 2: Remove Windows Security context menu
Method 3: Deploy via script or RMMx
Method 4: Validate Windows Security launch behavior

Method 1: Adding Windows Security to the desktop context menu via a custom registry entry

📌 Use Cases:

  • This provides fast access to Windows Security for administrators during incident response or malware investigations.
  • Enables a consistent shortcut across devices without relying on the Start menu or taskbar placement

📌 Prerequisites:

  • You will need administrative rights to make or modify registry keys under HKCR.
  • This requires Windows Security to be active and not disabled by policy.

Steps:

  1. Open Registry Editor via the search button on the task bar, or by pressing Win + R, typing regedit, and pressing Enter.
  2. Next, navigate to: HKEY_CLASSES_ROOT\DesktopBackground\Shell.
  3. Right-click Shell, select New > Key, and name it WindowsSecurity. 
  4. Select WindowsSecurity, double-click (Default), and set value to Windows Security.
  5. In the same key, create a String Value named Icon. Then, set its value to SecurityHealthSystray.exe.
  6. Right-click WindowsSecurity, select New > Key, and name it command.
  7. After this, select command, double-click (Default), and set the value to cmd.exe /c start “” “windowsdefender://”.
  8. Close the Registry Editor.

Method 2: How to remove Windows Security context menu entries

📌 Use Cases:

  • This removes Windows Security shortcuts that were added manually or via deployment scripts.
  • Restores the default context menu layout when entries are no longer needed or cause user confusion.

📌 Prerequisites:

  • You will need administrative access to modify registry keys under HKEY_CLASSES_ROOT.
  • This requires identifying which entries were added so you can safely remove only the intended keys.

Steps:

  1. Open Registry Editor. 
  2. Navigate to this key: HKEY_CLASSES_ROOT\DesktopBackground\Shell.
  3. Locate and delete the WindowsSecurity key.
  4. Close the Registry Editor.

Method 3: Deploy context menu entries through script or RMM

📌 Use Cases:

  • This allows MSPs and IT teams to apply or remove Windows Security context menu entries consistently across many devices.
  • Supports automated onboarding workflows where registry entries must be enforced during provisioning.

📌 Prerequisites:

  • You will need properly tested .reg files for adding or removing context menu entries.
  • This requires an RMM, Intune, or similar management tool capable of running user-context scripts.

Steps:

  1.  Open PowerShell and deploy this script:

$baseKey = "Registry::HKEY_CLASSES_ROOT\DesktopBackground\Shell\WindowsSecurity"

$cmdKey = "$baseKey\command"

New-Item -Path $baseKey -Force | Out-Null

New-Item -Path $cmdKey -Force | Out-Null

Set-ItemProperty -Path $baseKey -Name "(Default)" -Value "Windows Security"

Set-ItemProperty -Path $baseKey -Name "Icon" -Value "SecurityHealthSystray.exe"

Set-ItemProperty -Path $cmdKey -Name "(Default)" -Value 'cmd.exe /c start "" "windowsdefender://"'

  1. Push the script to target devices using your RMM, Intune, or another endpoint management platform.
  2. Next, add a verification step to confirm the registry path exists via PowerShell:

Test-Path "HKCR:\DesktopBackground\Shell\WindowsSecurity"

  1. Document the registry path, script location, and deployment procedure.

Method 4: How to validate Windows Security launch behavior

📌 Use Cases:

  • This confirms that added or deployed context menu entries correctly open Windows Security and trigger expected actions.
  • This helps verify that Defender is active and responding before rollout across multiple devices.

📌 Prerequisites:

  • You will need Windows Security enabled and not restricted by policy.
  • This requires at least one test file and a device where the context menu entries were recently added.

Steps:

  1. Right-click the desktop and select Show more options, then choose Windows Security.
  2. Confirm that the Windows Security dashboard opens without errors.
  3. Test individual modules such as Virus & threat protection, Firewall & network protection, or App & browser control to confirm full functionality.
  4. If you added the scan entry, right-click a known file and select Scan with Windows Security.
  5. Review Windows Security notifications or Protection history to verify that the scan completed and Defender logged expected activity.

⚠️ Things to look out for

RisksPotential ConsequencesReversals
Incorrect registry pathsThe context menu entry will not appear or may break other shell items.Verify the HKCR paths before deploying .reg files and confirm keys exist after import.
Defender disabled by policy or third-party AVThe Windows Security menu entry appears, but fails to open or run scans.Check Defender status, review security policies, or adjust scan commands for your AV environment.
Entries missing after reboot or cleanupShell keys may be removed by security tools or overwritten by scriptsReapply the registry entries and audit RMM or GPO settings that modify context menu keys.

Troubleshooting Windows Security context menu options

  • Entry does not appear: Check the DesktopBackground shell path, confirm the registry keys exist, and use Show more options in Windows 11.
  • Windows Security does not open: Verify the Windows Security app is enabled and not disabled by policy or a third-party antivirus.
  • Scan command fails: Confirm MpCmdRun.exe exists, Microsoft Defender is enabled, and the command path under the registry key is correct.
  • Entries disappear after a reboot: Permissions, cleanup tools, or RMM scripts could be removing shell keys. In this case, reapply the entries and audit conflicting policies.
  • The scan option is missing for some file types: Ensure the scan key is created under HKEY_CLASSES_ROOT\* rather than a file-specific extension key.

Streamline security workflows by customizing the Windows 11 context menu

Adding Windows Security to the desktop context menu gives administrators faster access to key protection features during troubleshooting or incident response. With simple registry edits and optional scripted deployment, you can standardize these entries across devices and maintain predictable behavior in managed environments.

Related topics:

FAQs

Most often, the key is added to the wrong HKCR path, Defender is disabled by policy, or the user is not selecting “Show more options” in Windows 11’s context menu.

The MpCmdRun.exe path may be incorrect, or Microsoft Defender may be replaced or disabled by a third-party antivirus.

Yes. You can deploy a PowerShell script that directly creates the registry keys and deploy it using PowerShell in a user context through RMM, Intune, or another MDM, then validate with a scripted Test-Path check.

Test on a dedicated device: open Windows Security from the context menu, launch each module, run a file scan, and verify that Defender logs the results in Protection history.

You might also like

Ready to simplify the hardest parts of IT?