Link to home
Start Free TrialLog in
Avatar of cajx
cajx

asked on

Remove Deployed Printers After Server Died

We have a couple of printers still being mapped to users. They show up under the relevant GPO under:

User Configuration - policies - windows settings - Printer Connections

I do not see a way to manually remove things there, though. Under Group Policy Management, if I edit the GPO, that last part of the path "Printer Connections" does not exist. I can only see this under the Settings tab when I do not edit.

I need to remove these printers that were deployed using Printer Management on a Windows 2008R2 server. How to do so?
ASKER CERTIFIED SOLUTION
Avatar of Jason Watkins
Jason Watkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cajx
cajx

ASKER

I'd rather not do that because I have other legitimate printers being pushed out on the same GPO. Is there another way to only remove the ones I want to remove?
I can't see a way around it with just a GPO. You'll have to use a script like the following.

' Remove all network printers

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Network = TRUE")

For Each objPrinter in colInstalledPrinters
objPrinter.Delete_
Next

Option 2:

' Remove Printers by name

Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.RemovePrinterConnection "\\PrintServer\xerox3006"

(Taken from: http://community.spiceworks.com/topic/91967-batch-script-to-uninstall-printers)
Avatar of cajx

ASKER

OK. I'd be tempted to remove them with the script by name, but then they are still going to show up in this GPO. I guess if there is no way to edit the GPO, I am forced to kill it.

I keep seeing people speak well of pushing printers out in the GPO under the area of:

Preferences - Control Panel - Printers

Never have I tried that before, but now I see a good reason to do so. It seems like you have much more control in the event of a server disappearing.

Thanks for the help!
My pleasure. Glad to help.