Link to home
Start Free TrialLog in
Avatar of smilneisom
smilneisom

asked on

Removing printers deployed by group policy

We've deployed printers very sucessfully to our Vista workstations using Group Policy, but there is one catch.  For some reason when we remove a printer from bring deployed via group policy it stays on the client machines.  The result is a mess of printers on the clients, some of which don't exist anymore.  

Everything I can find says that do delete the printers from the clients, all you have to do is remove them from being "deployed" in the GPO.  It doesn't seem to be working here at all.

Running GPUpdate doesn't help.  If you try to remove the printer manually, it just gives an access denied error.  

I'm sure that the printers are removed from group policy.  Just FYI: the printers were/are deployed on a per-user basis through group policy.  We have *not* used the Windows Printer Management Utility that comes with R2... the printers have been deployed/un-deployed by adding/removing them directly from the "deployed printers" section of the affected GPO.  All users seem to be experiencing this error.  Most users have "user" lever permissions (not admins), but even our network admins are having the issue when logged into their computers as administrators.

To summarize, the built-in "pushprinterconnections" script in Vista is doing a great job at deploying printers from GPO, but failing terribly at removing them.  Thanks in advance for any assistance.
Avatar of and235100
and235100
Flag of United Kingdom of Great Britain and Northern Ireland image

You can try the following as a vbscript:

--------------------------------------------------------------------------------
On error resume next

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections
WScript.Echo oPrinters.Item
WshNetwork.RemovePrinterConnection oPrinters.Item

--------------------------------------------------------------------------------
Avatar of smilneisom
smilneisom

ASKER

I entered what you had between the lines into "printers.vbs" on the desktop and ran it.  Unfortunately there were no visible results that occurred. Thanks for the input.
I didn't get a chance to test this on Vista - indeed, I didn't seem to get any visible difference either...
I can confirm - this doesn't work - will post back.
cscript prnmngr.vbs -x [-s RemoteComputer] [-u UserName] [-w Password]
This should run natively - as this particular vbs is part of windows by default. (it seems to be included in Vista - I can't verify this on a live system at the moment...)
I've attempted to run ""prnmngr.vbs".  It doesn't appear to exist on Vista... even tried changing into the sytem32 directory prior to running....
Okay - I will have a look at a vista-compatible script...
Will update soon.
I found a "nasty" workaround.  As I said before... for some reason the use can't delete the printers directly from the printers list (access denied error) and they don't "disapear" like they should.  The user can delete the registry key that contains the printer connections.  My example *.reg file is below.

*************************
Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Printers\Connections]
*************************

It isn't pretty b/c it kills the connections to all network printers (local ones are unaffected).  You have to wait for a Group Policy update to be processed or manually initiate one using GPUpdate to get the printers that *should* be there back.  Any ideas why the removing the printers isn't working as it should?
ASKER CERTIFIED SOLUTION
Avatar of and235100
and235100
Flag of United Kingdom of Great Britain and Northern Ireland 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
Service Pack 1 for Vista seems to have addressed the issue, at least for me.

We have a Server 2003 & Vista client environment with group policy in place, however the GPO was not governing the printers at the time of this incident.

We had the same problem with removing printers deployed via GPO.

Problem had to do with cached GPO's affecting pushprinterconnections.exe.  You'd see the old GPO's still being "found and applied" in the ppcMachine.log file.

Enabled the following GPO setting to fix it:

Computer Configuration \ Administrative Templates \ System \ Logon \ Always wait for network at computer startup and logon = Enabled.

I have had a similar situation with the problem of printers not being deleted when the GPO was altered or removed. This problem appears to have been corrected in Windows Vista. However in my testing it appears it is best to create a new GPO when you want to alter printers and delete the old one. I thought that I would implement this by creating a GPO for each printer that I want to deploy to clients.