Windows
View all Worklets
WindowsWindows

Windows - Security - Mitigate Print Nightmare

Disable PrintNightmare vulnerability by blocking remote printer spooler connections on Windows endpoints

Worklet Details

What the PrintNightmare mitigation does

This Automox Worklet™ mitigates the PrintNightmare zero-day vulnerability (CVE-2021-34527) by disabling client connections to the Printer Spooler Service through a registry modification. The Worklet sets the RegisterSpoolerRemoteRpcEndPoint registry key to a value of 2, which blocks remote RPC endpoints on the spooler service.

This vulnerability affected Windows systems and allowed unauthenticated remote code execution with system-level privileges when the Print Spooler service was enabled and accepting remote connections. By disabling remote connections while preserving local printing and printer sharing functionality, the Worklet eliminates the primary attack vector.

Why disable remote printer spooler access

PrintNightmare was a critical zero-day vulnerability that posed immediate risk to Windows endpoints. Attackers could exploit the Printer Spooler Service to gain system-level code execution remotely without authentication. This vulnerability affected organizations globally and required rapid mitigation before security patches were available.

By blocking remote spooler connections, this Worklet reduces your attack surface and prevents exploitation of CVE-2021-34527. The mitigation is effective on older Windows versions and systems not yet patched with KB5004945 or subsequent cumulative updates. You maintain full local printing capabilities and printer sharing for legitimate users.

How PrintNightmare mitigation works

  1. Evaluation phase: Checks if HKLM:\Software\Policies\Microsoft\Windows NT\Printers\RegisterSpoolerRemoteRpcEndPoint exists and equals 2. If the registry value is already configured correctly, the endpoint is compliant and the Worklet exits.

  2. Remediation phase: Creates the Printers registry key if it does not exist, sets RegisterSpoolerRemoteRpcEndPoint to 2, and restarts the Print Spooler service for changes to take effect immediately.

PrintNightmare mitigation requirements

  • Windows Server 2016 or later, or Windows 10

  • Administrator privileges to modify system registry

  • Print Spooler service must be running (the Worklet restarts it after modification)

  • Works on both WORKSTATION and SERVER endpoint types

  • Compatible with RunNow execution for immediate remediation

Expected spooler service security state

After remediation completes, the Printer Spooler Service no longer accepts remote client connections. The service continues running locally, so users can still print to local printers and access network printers through other mechanisms. Printer sharing remains functional for existing shared printers. The Print Spooler service restarts automatically, and the registry change takes effect immediately.

You can verify the change by navigating to HKLM:\Software\Policies\Microsoft\Windows NT\Printers and confirming that RegisterSpoolerRemoteRpcEndPoint is set to a DWORD value of 2. This eliminates the attack vector for CVE-2021-34527 while allowing normal printer operations to continue.

How to validate mitigate print nightmare changes

  1. Run this Worklet on a pilot Windows endpoint and review evaluation output for mitigate print nightmare.

  2. Confirm Automox activity logs show successful completion and exit code 0.

  3. Verify endpoint state using checks aligned to evaluation script logic, such as Write-Output, Remove-ItemProperty, Get-ItemProperty.

  4. Validate remediation effects from script operations such as Write-Output, Remove-ItemProperty, Get-ItemProperty, then rerun evaluation for compliance.

For technical validation, compare endpoint state to the Worklet evaluation logic and remediation flow for mitigate print nightmare. This supports repeatable security workflows, faster change control review, and auditable compliance evidence.

Useful script references for this Worklet include evaluation operations such as Write-Output, Remove-ItemProperty, Get-ItemProperty and remediation operations such as Write-Output, Remove-ItemProperty, Get-ItemProperty. Use these indicators to verify that endpoint changes match intended policy outcomes.

View in app
evalutation image
remediation image

Consider Worklets your easy button

What's a Worklet?

A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

do more with worklets