Network Printer Connections in Group Policy via batch file or vbs. Cannot delete old printers correctly. They reapear after deletion!
Posted on 2011-03-22
I have written a simple batch file to run via group policy that connects to our network shares and deletes all local users printers, a vbs script is then run which installs a new Colour laser printer shared by the domain controller server.
This has been tested under a staff login with access to the printers and faxes window. And the the batch file deletes all priunter connections and then running the vbs file created a single network printer connection.
Unfortunately when I include them in group policy..strange things happen.
When Logging on;
Shares are connected but when I try to print there are three old printer connections present and the new printer connection is not visable. I have tried putting the batch file in a shared resource and running them again after loging on and they work fine. The first file the batch file connects to the relevant shares and deletes all printer connections. I then run the vbs script which installs the new network printer connection! All good.
So I looked into the group policy management, I removed all logon scripts in the default domain policy, I checked using gpedit.msc the local PCs had not got any logon scripts and I logged on locally to the administrator account and deleted all the printer connections (there were the 3 old connections that keep being populated) I logged on as the domain administrator on the workstation and again deleted all printer connections. I logged onto the server and checked there was only the new printer installed and shared.
I don't understand why the old printer connections are being populated and why the new connection is never present. Please any suggestions would really help