Any vb wizards out there that can help with this please? I wish to create a vb script that removes all network printers on a client xp workstation that are connected to a print server named "\\STSV1000". The script below (which I have not written) deletes all networked printers connected to any print server. I do not understand how to edit the script so that only printers connected to "\\STSV1000" are removed. Any helpers please?
'Declare and set a Network Object
Dim WSHNetwork
Set WSHNetwork = CreateObject("WScript.Network")
'Declare and and get all printer connections
Dim WSHPrinters
Set WSHPrinters = WshNetwork.EnumPrinterConnections
'Resume when an error occurs
On Error Resume next
Dim prcount 'Printer Count
Dim prName 'Printer Name
'Loop through the printers
For prcount = 0 To WSHPrinters.Count - 1 Step 2
'Get the printer name
prName = WSHPrinters.Item(prcount + 1)
'If the printer name starts with a \\ the remove it
If Left(prName, 2) = "\\" Then
WshNetwork.RemovePrinterConnection prName, True, True
End If
Next
On Error Goto 0
'Declare and set a Network Object
Dim WSHNetwork
Set WSHNetwork = CreateObject("WScript.Network")
'Declare and and get all printer connections
Dim WSHPrinters
Set WSHPrinters = WshNetwork.EnumPrinterConnections
'Resume when an error occurs
On Error Resume next
Dim prcount 'Printer Count
Dim prName 'Printer Name
'Loop through the printers
For prcount = 0 To WSHPrinters.Count - 1 Step 2
'Get the printer name
prName = WSHPrinters.Item(prcount + 1)
'If the printer name starts with a \\ the remove it
If Left(prName, 2) = "\\" Then
WshNetwork.RemovePrinterConnection prName, True, True
End If
Next
On Error Goto 0