Many administrators running Windows Server 2012/R2 print servers encounter an annoying issue where printers automatically switch from their assigned TCP/IP ports to WSD ports. This behavior breaks printing functionality as clients can't connect to the changed ports.
While there are several documented workarounds, they all have significant drawbacks:
- Disabling Network Discovery affects other essential services
- Firewall blocking requires complex rule management
- Printer-side configuration isn't scalable across large deployments
Unlike Windows Server 2008 R2 where you could disable the PnP-X IP Bus Enumerator, Server 2012/R2 requires a different approach. Here's the most effective solution:
# PowerShell command to disable WSD
Stop-Service -Name "WSDPrintDevice" -Force
Set-Service -Name "WSDPrintDevice" -StartupType Disabled
# Optional: Prevent WSD port creation via registry
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\WSDPrintDevice" -Name "Start" -Value 4 -PropertyType DWORD -Force
For domain environments, you can deploy this setting via GPO:
- Create a new GPO targeting your print servers
- Navigate to: Computer Configuration > Preferences > Windows Settings > Registry
- Add a new registry item with these values:
Hive: HKEY_LOCAL_MACHINE Key Path: SYSTEM\CurrentControlSet\Services\WSDPrintDevice Value Name: Start Value Type: REG_DWORD Value Data: 4
After implementation, check that:
Get-Service -Name "WSDPrintDevice" | Select Status, StartType
Should return "Stopped" for Status and "Disabled" for StartType.
For printers that have already switched to WSD ports, use this script to clean up and recreate proper TCP/IP ports:
$printers = Get-Printer | Where {$_.PortName -like "WSD*"}
foreach ($printer in $printers) {
$portName = "IP_" + $printer.Name
Add-PrinterPort -Name $portName -PrinterHostAddress $printer.DriverName
Set-Printer -Name $printer.Name -PortName $portName
}
If you've managed print servers on Windows Server 2012/R2, you've likely encountered printers mysteriously switching from static TCP/IP ports to WSD (Web Services for Devices) ports. This automatic behavior breaks printing functionality since WSD ports are dynamic and unreliable for enterprise deployments.
The commonly suggested fixes have significant drawbacks:
- Disabling Network Discovery affects other essential services
- Firewall blocking requires complex rule management
- Printer-side configuration isn't scalable across hundreds of devices
Windows Server 2008 R2 had a straightforward solution - disabling the "PnP-X IP Bus Enumerator" service. However, this service was removed in Server 2012, leaving administrators without a clean solution.
Here's a PowerShell script that completely disables WSD functionality at the system level:
# Disable WSD through registry
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\WSDPrintDevice" -Name "Start" -Value 4 -Type DWord
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\WSDScan" -Name "Start" -Value 4 -Type DWord
# Prevent WSD port creation for existing printers
$printers = Get-Printer | Where-Object {$_.PortName -like "WSD*"}
foreach ($printer in $printers) {
$portName = "IP_" + ($printer.Name -replace "[^a-zA-Z0-9]", "")
Add-PrinterPort -Name $portName -PrinterHostAddress $printer.DriverName
Set-Printer -Name $printer.Name -PortName $portName
}
# Optional: Block WSD network traffic
New-NetFirewallRule -DisplayName "Block WSD Traffic" -Direction Inbound -Protocol TCP -LocalPort 5357,5358 -Action Block
To prevent future WSD port switches, implement this monitoring script as a scheduled task:
$checkInterval = 300 # 5 minutes
while ($true) {
$wsdPrinters = Get-Printer | Where-Object {$_.PortName -like "WSD*"}
if ($wsdPrinters) {
# Send alert and fix ports
Send-MailMessage -To "admin@domain.com" -Subject "WSD Printer Alert" -Body ($wsdPrinters | Out-String)
.\Fix-WSDPrinters.ps1 # Your correction script
}
Start-Sleep -Seconds $checkInterval
}
For large environments, combine these techniques with Group Policy Preferences to deploy the registry changes and scripts across all print servers. The following GPO settings are particularly effective:
- Computer Configuration > Preferences > Windows Settings > Registry
- Computer Configuration > Preferences > Control Panel Settings > Scheduled Tasks