{"id":"8kg8cqhbg9","url":"https://pastebin.ca/8kg8cqhbg9","raw_url":"https://raw.anybin.ca/8kg8cqhbg9","visibility":"public","access":"public","created_at":1795377316333,"expires_at":1795982116333,"fetch_limit":null,"fetches_used":0,"reads_remaining":null,"size_bytes":913,"syntax_hint":null,"title":null,"filename":null,"change_note":null,"cipher":null,"cipher_meta":null,"parent_id":null,"root_id":"8kg8cqhbg9","version":1,"owner_id":null,"recipient_id":null,"body":"$Url  = 'http://HP48EA62BF714A.local:631/ipp/print'\n$Name = 'HP Envy 6500e'\n\n# Remove any leftover device carrying that exact name (any class except scanner)\nGet-PnpDevice | Where-Object { $_.FriendlyName -eq $Name -and $_.Class -ne 'Image' } |\n    ForEach-Object { pnputil /remove-device \"$($_.InstanceId)\" }\nRestart-Service Spooler -Force; Start-Sleep 5\n\n# Add, verify, print only if it really exists on an IPP port\nAdd-Printer -Name $Name -IppURL $Url\nStart-Sleep 5\n$p = Get-Printer -Name $Name -ErrorAction SilentlyContinue\nif ($p) {\n    $p | Format-List Name,DriverName,PortName,PrinterStatus\n    if ($p.PortName -notlike 'WSD-*') {\n        Get-CimInstance Win32_Printer -Filter \"Name='$Name'\" | Invoke-CimMethod -MethodName PrintTestPage | Out-Null\n        \"SUCCESS: test page sent over IPP.\"\n    } else { Write-Warning \"Queue exists but is on a WSD port.\" }\n} else { Write-Warning \"No queue was created.\" }"}