Wednesday, August 13, 2014

Printing Frustration Kicks In. And always in the morning...


So for whatever reason (mine was an unsigned driver update) you need to delete and recreate all your network printers.

KillAllNetworkPrinters.vbs
Const NETWORK = 22
Set objNetwork = CreateObject("WScript.Network")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer")
   
For Each objPrinter in colPrinters
    If objPrinter.Attributes And NETWORK Then 
        strPrinter = objPrinter.Name
        objNetwork.RemovePrinterConnection strPrinter
    End If
Next

As far as adding the printers... I know there are several maybe better ways to handle this but Ive run into enough issues that I just dump a list from the printserver(s) into a bat file ala.. 

ECHO - Installing Printers
start \\printsever1\printer1
start \\printsever1\printer2
start \\printsever2\printer1
start \\printsever2\printer2
etc etc

These are not remote operations.  If you want to do it remotely... >>>>  Google.com

No comments:

Post a Comment