efiftythree
IS-IT--Management
Hello all!
Here is what I want to do. At login I want to check to see if printer \\bhc2\cd_3800dtn is installed. If that printer is installed I want to end the script. If that printer is not installed I want to remove a couple of existing printers and install a new printer. The existing printers I want to remove are installed as local printer via a tcp/ip port which connects to a jetdirect not a print server so I don’t know if I can use a UNC path or not. Any help would be greatly appreciated.
Here is the code that I have attempted to create after browsing several threads in this forum. It errors out at the "Else" because I have not implemented that correctly as I don't really know how.
Here is what I want to do. At login I want to check to see if printer \\bhc2\cd_3800dtn is installed. If that printer is installed I want to end the script. If that printer is not installed I want to remove a couple of existing printers and install a new printer. The existing printers I want to remove are installed as local printer via a tcp/ip port which connects to a jetdirect not a print server so I don’t know if I can use a UNC path or not. Any help would be greatly appreciated.
Here is the code that I have attempted to create after browsing several threads in this forum. It errors out at the "Else" because I have not implemented that correctly as I don't really know how.
Code:
Set WSHPrinters = WSHNetwork.EnumPrinterConnections
PrinterPath = "\\bhc2\cd_2800dtn"
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
If WSHPrinters.Item(LOOP_COUNTER +1) = PrinterPath Then
End If
Else
objNetwork.RemovePrinterConnection "LaserJet 5Si"
objNetwork.RemovePrinterConnection "Color LaserJet 4550"
On Error Resume Next
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\bhc2\CD_3800dtn"
End If