Remove a printer installed by Profile Manager or MCX from the command line (or remote ARD command)

When Profile Manager installs a printer, the CUPS queue name doesn’t match what the user sees. You can get a list of those queues by typing lpstat -s. To remove the printer by the name you define in Profile Manager with a script, you’ll need to find out the CUPS name.

Here’s a one-liner to remove a printer that was automatically installed with Profile Manager:

export ptr="PRINTERNAME";lpstat -s | awk "\$4 ~ /$ptr/ {print \$3}" | tr -d : | xargs lpadmin -x

Just replace PRINTERNAME with the correct queue name.