Answer the question
In order to leave comments, you need to log in
How to remove printers by name mask via command line?
Good afternoon. I know a command that deletes a printer by name, but I don’t know how to delete all printers in whose names there is the word Canon.
Command to delete a specific printer:
rundll32.exe printui.dll,PrintUIEntry /dl /n "Canon MF210 Series" /q
Tried to do this type, but did not work:
rundll32.exe printui.dll,PrintUIEntry /dl /n "Canon* "/q
Answer the question
In order to leave comments, you need to log in
via powershell running with admin rights:
PS C:\Windows\system32> get-printer
Name ComputerName Type DriverName PortName Shared Published DeviceType
---- ------------ ---- ---------- -------- ------ --------- ----------
Printer-BADC Local Samsung Universal Prin... WSD-b2a188e9... False False Print
Microsoft XPS Document Writer Local Microsoft XPS Document... PORTPROMPT: False False Print
Microsoft Print to PDF Local Microsoft Print To PDF PORTPROMPT: False False Print
Fax Local Microsoft Shared Fax D... SHRFAX: False False Print
PS C:\Windows\system32> get-printer | where name -match "print"
Name ComputerName Type DriverName PortName Shared Published DeviceType
---- ------------ ---- ---------- -------- ------ --------- ----------
Printer-BADC Local Samsung Universal Prin... WSD-b2a188e9... False False Print
Microsoft Print to PDF Local Microsoft Print To PDF PORTPROMPT: False False Print
PS C:\Windows\system32> get-printer | where name -match "print" | remove-printer
PS C:\Windows\system32> get-printer
Name ComputerName Type DriverName PortName Shared Published DeviceType
---- ------------ ---- ---------- -------- ------ --------- ----------
Microsoft XPS Document Writer Local Microsoft XPS Document... PORTPROMPT: False False Print
Fax Local Microsoft Shared Fax D... SHRFAX: False False Print
If the command does not support regular expressions, then you need to wrap it in a loop.
https://www.computerperformance.co.uk/powershell/e...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question