How to fully remove a printer using PowerShell or Command line

Mike xx 6 Reputation points
2021-04-22T00:31:23.43+00:00

I can use:
remove-printer <name>
remove-printerdriver <name>

but in "Printers and scanners" list the printer remains with a note "Driver is unavailable".

This prevents a re-install of the printer driver (even with a reboot / pinter connected or not connected) and the only way to resolve the problem is to manually remove the printer from "Printers and scanners".

Hence the subject line.

I'm conscious this is a long standing bug as per:
https://answers.microsoft.com/en-us/windows/forum/windows_10-other_settings/deleteprinter-not-working-properly-in-recent/59f9906e-c146-44ca-be8b-d88c5e716cee

But wondering if any progress has been made towards a solution.

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Anonymous
    2021-04-22T04:53:15.863+00:00

    Hi,

    Have you tried the methods suggested by Monica Cam from your link? Does the printer still remain if you restart the spooler service and remove the registry key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers?

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Mike xx 6 Reputation points
    2021-04-22T12:24:14.64+00:00

    Many thanks for your answer.

    In an elevated Command prmpt I can run:
    net stop spooler

    With the response:
    The Print Spooler service is stopping.
    The Print Spooler service was stopped successfully.

    However the printer persists in "Printers & scanners" with "Driver is unavilable".

    I can restart the spooler service and the the printer persists in "Printers & scanners" with "Driver is unavilable".

    After some further research:
    If I wait a minute or so

    Then I switch/connect the printer I get the same "progress bar" as if the driver was still available and the printer is being installed, except it pauses and gets 'stuck' at around 10% progress.

    If I disconnect the printer, I lose the "Driver is unavalable tag".

    I can wait as long as I want. If I touch the elevated Command Prompt the printer disappears it disappears from "Printers & scanners". What appears to be a coincidence is remarkably reliable but starangely connected behaviour.

    After further research, using "remove-printerdriver" I get "remove-printerdriver : The specified driver is in use by one or more printers." and the only way forward is to manually remove the printer from "Printers & scanners".

    This removal of printers still appears very buggy. Why there is a GUI means to remove printer but no command line method beats me!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.