DSapseid Posted September 23, 2008 Posted September 23, 2008 Hi I have had a lot of problems recently at one of the primary schools i support and i have got them it pretty much all working again now apart from one thing - the printers!!! Sorry i know its been covered before but my brain is fried and i cant think of where to start. All i need is a simple script to delete any existing printers, local/network then add one shared printer from the server. It is just an ICT suite so it doesnt need to look at locations. I dont mind what language its in. batch/vbs/autoIT i dont mind it just needs to run as a logon script. I would be eternally grateful!
mattx Posted September 23, 2008 Posted September 23, 2008 Set WshNetwork = CreateObject("WScript.Network") rem ** This will delete existing printers ** On Error Resume Next Set oPrinters = WshNetwork.EnumPrinterConnections For i = 1 to oPrinters.Count - 1 Step 2 WshNetwork.RemovePrinterConnection oPrinters.Item(i) Next rem ** Adds printers - new line for each printer ** Set WshNetwork = CreateObject("WScript.Network") WshNetwork.AddWindowsPrinterConnection "\\SRVNAME\PTRSHARE" WshNetwork.AddWindowsPrinterConnection "\\SRVNAME\PTRSHARE2" rem ** Setup default printer ** WshNetwork.SetDefaultPrinter "\\SRVNAME\PTRSHARE" 1
DSapseid Posted September 23, 2008 Author Posted September 23, 2008 Thanks alot, will try out tommorow.
contink Posted September 23, 2008 Posted September 23, 2008 You may find that some printers will refuse to be deleted because they were added to the local system some other way. There's some discussion about it in various threads but just a note so you don't think you're losing your mind.
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