TheRobins Posted March 31, 2014 Posted March 31, 2014 Morning all I am dealing with a school who have a messed up AD and printer solution. Managed to get that sorted, I'm just wondering if there is a script to remove "dead" printers. I know I can remove printers is I know the name and server they were shared from, however this is in such a state that some users have 15 old printer connections that have been removed. I was almost tempted to run along the lines of "server1/*.*" "server2/*.*" but not sure with printers whether that would work or what mayhem may start, Any Tips/Pointers would be most welcome Below is the SpiceWorks script I have used for a couple of years. 'Begin Script 'Remember to edit the printer address variables of strPrinter1 and strPrinter2 as well as the strComputer field strComputer = "." strPrinter1 = "\\server\Printer1" strPrinter2 = "\\server\Copier1" Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colPrinters = objWMI.ExecQuery("Select * From Win32_Printer") For Each objPrinter in colPrinters on error resume next If Lcase(objPrinter.name) = Lcase(strPrinter1) Then Set objNetwork = CreateObject("Wscript.Network") objNetwork.RemovePrinterConnection strPrinter1 Else If Lcase(objPrinter.name) = Lcase(strPrinter2) Then Set objNetwork = CreateObject("Wscript.Network") objNetwork.RemovePrinterConnection strPrinter2 End If End If Next 'End Script
featured_spectre Posted March 31, 2014 Posted March 31, 2014 I would suggest remove all printers, then add them from scratch again 1
TheRobins Posted March 31, 2014 Author Posted March 31, 2014 All Printers have gone. I am now using Print Deployment in Server2008R2 which is working fine, its just the old remaining printers. I am going to try and log-off script to remove all printers and with GPO deployment it will sort itself out soon I hope.
Joanne Posted March 31, 2014 Posted March 31, 2014 I found that if you use group policy preferences to remove them, that works too. Create a new GPO, attach to users, then go to User Configuration | Preferences | Control Panel Settings | Printers right click, select new shared printer, then select delete and delete all printer connections. If you run this as the first one, you can then apply the printers you want afterwards. Hope this helps.
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