Remove all printers using printui.dll commands


  • I have a login script that adds printers to users profile like this:

    Rundll32 printui.dll,PrintUIEntry /ga /n\\server\printer

    However, i would like to remove all current printers on the machine before re-adding printers. I have found a command (dn) that will remove a printer however i would have to name every printer. Is there a command that will remove all printers?

    Thursday, August 26, 2010 11:28 AM

All replies

  • I think you need these lines in a logon script, think it only does networked printers rather than local :


    strComputer = "."

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    Set colInstalledPrinters = objWMIService.ExecQuery _
        ("Select * From Win32_Printer Where Network = True")

    For Each objPrinter in colInstalledPrinters


    Might be wrong though so please someone correct me if i am.
    Thursday, August 26, 2010 12:02 PM
  • That seems to do the trick, thank you :-) For some reason the printer isnt installing quietly now even though i have the quiet command in ther, please see below:

    cscript "C:\Documents and Settings\test.user\Desktop\DeletePrinters.vbs"

    Rundll32 printui.dll,PrintUIEntry /in /q /n\\server\printer

    The location of the script will be changed, just using that location for testing purposes for now. Any suggestions on silent install? Thank you, Richard

    Thursday, August 26, 2010 1:05 PM
  • Hi Richard,

    Maybe try removing the /in command. I have added network printers with this before with no problems :

    rundll32 Printui.dll,PrintUIEntry /n \\Servername\Printername


    Friday, August 27, 2010 8:22 AM