Tech01 Posted September 22, 2014 Posted September 22, 2014 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
Norphy Posted September 22, 2014 Posted September 22, 2014 You could try PowerShell? Something like Get-Printer -name \\atl-ps-01* | Remove-Printer should work
jinnantonnixx Posted September 22, 2014 Posted September 22, 2014 (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 September 22, 2014 by jinnantonnixx
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now