Sonic007 Posted November 23, 2022 Posted November 23, 2022 Hi, If I want to remove my network printers that are deployed via user GPO do I just delete the GPO and then gpupdate on the client machines? Thanks.
XiJ Posted November 24, 2022 Posted November 24, 2022 I usually leave the printers installed an the print server and set the deploying GPP to delete. You could also set the gpp to just delete all shared printers - but it depends how you deploy them (shared / tcp-ip etc) I’d think the GPP would be able to remove GPO deployed printers - but I don’t use that method so couldn’t say 100% 1
PotNoodleTech Posted November 24, 2022 Posted November 24, 2022 You could run a VB file on logoff to remove the printers I think I've got one here somewhere I used a while back. 1
Sonic007 Posted November 24, 2022 Author Posted November 24, 2022 Im just testing things out at the moment. I have a feeling it is goingto be a long day! At first the printers were coming back, but I've deleted them from the GPO, and off the servers printer list itself. Going to test if that has worked. Wouldnt mind seeing your script if you have it as may need something if things fail to work. Thankyou.
djm968 Posted November 24, 2022 Posted November 24, 2022 This VB Script will remove all shared 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 1
Sonic007 Posted November 24, 2022 Author Posted November 24, 2022 Thankyou for this. I'e just tried running it and it gives an error. Line2 Char1. Any ideas? Many thanks and I appreciate the help.
djm968 Posted November 24, 2022 Posted November 24, 2022 Try this. 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
Sonic007 Posted November 24, 2022 Author Posted November 24, 2022 It’s been a long day so I apologise if I’m doing this wrong. I’ve copied that into notepad and saved as Remove printers.vbs And then just double clicked that and it just throws an error at me. Should I be doing this another way? Thankyou.
georgeescott Posted November 24, 2022 Posted November 24, 2022 You can use GPP preferences to either ‘delete all’, delete specific printers, or set it to ‘replace’ and set it to be removed if it no longer applies in item-level targeting.
djm968 Posted November 25, 2022 Posted November 25, 2022 It’s been a long day so I apologise if I’m doing this wrong. I’ve copied that into notepad and saved as Remove printers.vbs And then just double clicked that and it just throws an error at me. Should I be doing this another way? Thankyou. There is an issue copying and pasting the text to and from the post. I've just tried it myself and I get the same error, but the original file works fine. I've wrapped it in to see if that makes a difference. I can also send a plain text file if you prefer. [code]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
Sonic007 Posted November 28, 2022 Author Posted November 28, 2022 Sorry, me again. This only works with admin users. Is there a way to ake it run for all users? Thankyou.
djm968 Posted November 28, 2022 Posted November 28, 2022 Sorry, me again. This only works with admin users. Is there a way to ake it run for all users? Thankyou. The best option would be to set in a GPO as a start-up script, it will then run with admin privileges.
Oaktech Posted November 28, 2022 Posted November 28, 2022 If you're doing it via GPP, have you tried adding a 'delete all' printer at the top and then add everything else below it...
Sonic007 Posted November 28, 2022 Author Posted November 28, 2022 None of it worked. I've decided to just start adding the new printers manually for the time being. IS there something in the registry I can do locally to remove user sunwanted printers? I assume they wont come back as GPO no longer there on server.
jezi55 Posted November 28, 2022 Posted November 28, 2022 We recently had an abolute nightmare where we had our printers refreshed but they kept the same name just different drivers etc. Users were mapping printers via GPO but it was picking up the old drivers and when you removed them they kept coming back etc. We found out by removing the registry on the computers fixed 50% of them, the others we had to re-image unfortunatly. Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Drivers HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl\SetControl\Print\Printers You may need to stop the print spooler service when applying the fixes above. 1
Sonic007 Posted November 29, 2022 Author Posted November 29, 2022 Thankyou for your reply jezi55. I will try that.
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