# Disable WSD Discovery Service
Set-Service -Name FDResPub -StartupType Disabled
Set-Service -Name FDResPub -Status Stopped
# Configure Group Policy to Disable WSD Printer Installations
$policyPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Printers"
if (!(Test-Path $policyPath)) {
New-Item -Path $policyPath -Force | Out-Null
}
New-ItemProperty -Path $policyPath -Name DsDriver -Value 1 -PropertyType DWORD -Force | Out-Null
# Restart the computer to apply changes
Write-Output "WSD printer installations disabled. Restarting computer..."
Restart-Computer -Force