$Url = 'http://HP48EA62BF714A.local:631/ipp/print' $Name = 'HP Envy 6500e' # Remove any leftover device carrying that exact name (any class except scanner) Get-PnpDevice | Where-Object { $_.FriendlyName -eq $Name -and $_.Class -ne 'Image' } | ForEach-Object { pnputil /remove-device "$($_.InstanceId)" } Restart-Service Spooler -Force; Start-Sleep 5 # Add, verify, print only if it really exists on an IPP port Add-Printer -Name $Name -IppURL $Url Start-Sleep 5 $p = Get-Printer -Name $Name -ErrorAction SilentlyContinue if ($p) { $p | Format-List Name,DriverName,PortName,PrinterStatus if ($p.PortName -notlike 'WSD-*') { Get-CimInstance Win32_Printer -Filter "Name='$Name'" | Invoke-CimMethod -MethodName PrintTestPage | Out-Null "SUCCESS: test page sent over IPP." } else { Write-Warning "Queue exists but is on a WSD port." } } else { Write-Warning "No queue was created." }