none
GPO to remove network printers

    Question

  • Hi all

    I have a windows 2003 server which until recently was acting as a print server, no GPO`s in place and the clients computers printer connection to the server were just set up manually. The server was beginning to fail more often and the printer spooler especially so recently I have migrated, installed and applied a GPO for the printers on site to their 2008 R2 server.

    This is all working fine, printers connect on log in via the log in script and GPO. But what I have been unable to do is somehow apply a GPO to remove the network printers from clients computers that were originally pointing to the old 2003 server. So now they have 2 lots of the printers on site, 1 from the new server and 1 from the old.

    I originally had this script created to remove 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

    Yes it works...but sort of. It actually removes all printers randomly on log in, even the ones that have been added via the GPO I put in place. This happens no matter how high on the list I put the GPO. There are no error when users log in, just that they have no printers. Remove the link to the GPO and everything goes back to normal, new printers get applied via the GPO i created and the old printers stay there.

    I have just removed them from the old server and then got each user to just delete them from their workstation as there are under 15 client computer but I would like to find out any info as to what might be going wrong.Or if there might be another way I can apply a GPO and log in script to remove all old network printers.

    Any help would be grately appreciated

    Thanks

    Mark

    Tuesday, October 26, 2010 5:58 AM

All replies

  • Hi Mark,

    So as I understand it, you have a pile of client computers with printers mapped to the old print server and you'd like to remove these while adding the new ones.

    If you are running a 2k8+ domain controller with either XP clients with the GP Client Side Extensions or Vista+ clients, you can remove the printers using Group Policy Preferences and then map any new printers afterward.

    If you're running a 2k3 domain controller, I would suggest using con2prt.exe (http://thisishelpful.com/con2prtexe-map-delete-set-default-printer.html). It worked well for me for years and is a decent way to delete printers and map new ones.

    Hopefully this helps!

     - Liam

    • Proposed as answer by liso Monday, November 15, 2010 5:04 AM
    Wednesday, November 10, 2010 8:39 PM
  • Hi Mark,

    Did you have a chance to test this out?

     - Liam

    Monday, November 29, 2010 4:35 PM
  • What about WMIC?
      Delete Non-Local Printers:
      > wmic printer where "Local='FALSE'" delete
      Delete only Local Printers:
      > wmic printer where "Local='TRUE'" delete

      Delete all Printers:
      > wmic printer delete
    Tuesday, November 30, 2010 12:04 AM
  • If you are running a 2k8+ domain controller with either XP clients with the GP Client Side Extensions or Vista+ clients, you can remove the printers using Group Policy Preferences and then map any new printers afterward.

    Hi Liam,

    You can delete printers with GPP only if they were installed using GPP. And you cannot delete them in "bulk", like using a "delete printer *" command. If you don't know what the printers names are, you are f...d. Yeah, I am with you, but this is the reality for now. I hope something change in the near future with this option in GPP. To have a "Delete all printers" option would be great. Till then, we have to stick to the old scripts (con2prnt or wmic). They'll for sure delete ALL the local and network printers installed on a computer.

    Tuesday, November 30, 2010 12:21 AM
  • If you are running a 2k8+ domain controller with either XP clients with the GP Client Side Extensions or Vista+ clients, you can remove the printers using Group Policy Preferences and then map any new printers afterward.

    Hi Liam,

    You can delete printers with GPP only if they were installed using GPP. And you cannot delete them in "bulk", like using a "delete printer *" command. If you don't know what the printers names are, you are f...d. Yeah, I am with you, but this is the reality for now. I hope something change in the near future with this option in GPP. To have a "Delete all printers " option would be great. Till then, we have to stick to the old scripts (con2prnt or wmic). They'll for sure delete ALL the local and network printers installed on a computer.

     

    Hi there,

    I mocked this up in my demo environment and you can definitely delete all IP printers (there's a checkbox to accomplish that), even if they've been mapped without the involvement of Group Policy Preferences.

     - Liam

    Tuesday, November 30, 2010 10:50 PM
  • Hi there,

    I mocked this up in my demo environment and you can definitely delete all IP printers (there's a checkbox to accomplish that), even if they've been mapped without the involvement of Group Policy Preferences.

     - Liam

    Can you do the same for Shared Printers using GPP?
    NaZz
    Wednesday, March 02, 2011 9:38 PM
  • Not sure - I haven't tried. We'll be rolling out print servers over the next six months or so - I'll let you know!
    Thursday, March 31, 2011 7:08 PM
  •  Hello

    WMIC doesn't work if you have deployed printers using print management console.


    Sumy Sebastian

    Wednesday, March 28, 2012 2:57 PM