Jump to content

Recommended Posts

Posted

Hi All,

 

I need to make a script up to delete all printers from out old printserver.

 

Instead of doing this,

 

objNetwork.RemovePrinterConnection "\\atl-ps-01\printer1"

objNetwork.RemovePrinterConnection "\\atl-ps-01\printer2"

objNetwork.RemovePrinterConnection "\\atl-ps-01\printer3"

objNetwork.RemovePrinterConnection "\\atl-ps-01\printer4"

objNetwork.RemovePrinterConnection "\\atl-ps-01\printer5"

 

is there a way to make a script that says delete all printers from ' PrintSRV'

 

Regards

J

Posted (edited)

Powershell (which I find horrible) is better than VBS (which is also horrible), but if you require VBS this snippet might be useful. Amend as required.

 

 

Set printerscollectionobj = NetObj.enumprinterconnections
For i = 0 To (printerscollectionobj.Count - 1)
printerpath = CStr(printerscollectionobj.Item(i))
If Left(printerpath, 2) = "\\" Then NetObj.removeprinterconnection printerpath
	If Left(printerpath, 3) = "LPT" and InStr(1,printerpath,":")=0 Then NetObj.removeprinterconnection printerpath
Next

Edited by jinnantonnixx

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...