Kaseya Community

Script to remove inactive printers

  • Looking to write a script that will delete all inactive printers/printers that are not connected. It doesn't need to uninstall drivers, just remove them from the list of printers. 

    I did some research but couldnt figure out if this is possible. Anyone have suggestions?

  • Any tips?

  • XP/2003

    %WINDIR%\system32\cscript.exe //NoLogo "%WINDIR%\System32\prndrvr.vbs"

    Vista/7/8/2008/2012

    %WINDIR%\system32\cscript.exe //NoLogo "%WINDIR%\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs"

    -x     (delete all drivers that are not in use)



    [edited by: HardKnoX at 2:38 PM (GMT -8) on Nov 5, 2012] update
  • Note that it will uninstall the drivers not remove printer. To remove network printers for user profiles you could use the NET USE command or you can use the prnmngr.vbs script located in the same path as the prndrvr.vbs script with the following switches:

    -d     (delete printer

    prnmngr.vbs - d -p "[server]\[printer share name]"

    -x     (Delete all printers)

    -xc    (Delete all network printer connections)

    -xo    (Delete all local printers)

  • Thanks but non of these switches will delete printers not in use, will they?

    Good start though... thanks