Disable PrintNightmare vulnerability by blocking remote printer spooler connections on Windows endpoints
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.
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.
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.
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.
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
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.
Run this Worklet on a pilot Windows endpoint and review evaluation output for mitigate print nightmare.
Confirm Automox activity logs show successful completion and exit code 0.
Verify endpoint state using checks aligned to evaluation script logic, such as Write-Output, Remove-ItemProperty, Get-ItemProperty.
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.


By submitting this form you agree to our Master Services Agreement and Privacy Policy.
Already have an account? Log in
Consider Worklets your easy button
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.

AUTOMOX + WORKLETS™
Uncover new possibilities with simple, powerful automation.
By submitting this form you agree to our Master Services Agreement and Privacy Policy