We help IT Professionals succeed at work.

How to remove old Print Queue in all computer in an OU ?

958 Views
Last Modified: 2015-12-28
Hi People,

How can I delete any existing print queue in all of my workstations in an OU after adding new print queue using: http://blogs.technet.com/b/canitpro/archive/2015/02/04/step-by-step-setting-up-printers-via-group-policy.aspx ?

Note:
Single Forest AD domain
Print Server - Win 2008 R2
Domain Controller - Win 2012 R2 (DFL/FFL Windows Server 2008 R2)

Clients are all 64 bit:
Windows 7
Windows 8.1
Windows 10

Thanks in advance.
Comment
Watch Question

CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Take a test machine with such a print queue and look at the registry at HKCU\printers if I remember correctly. You could deploy registry deletions using GPP.
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
McKnife,

Is there any way to completely remove any printer queue and then just replaced it with the one I define from the other post ?

This is to standardize the print server queue for each people in OU specific groupings.

At the moment user can freely print anything anywhere which has to stop.
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
So based on this VB script running on Startup:

'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

Open in new window


That's bit confusing and requires manual works of listing all possible models of printer mapped by the users.

Is that the solution ?
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
I have no access at the moment to look it up. Do the following
-take a computer with printer "printername"
-open regedit search for printername
-take note of the registry path
-write a script that will use a for loop to delete the printers like this
for /f %%a in ('reg query yourpathhere') do net use %%a /delete
and distribute that as a logon script.
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
ok, what about if I remove or delete the group policy below to add the new print queue:

Computer Configuration | Policies | Windows Settings | Printer Connections | Path

will that also clears up the print queue that has been added before or it will leave it on peoples computer ?
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
You can use the vbscript, powershell or use a logout script with
As well as a GPO with a shutdown script to remove printer queue that were setup on the computer using rundll32.exe printui interface..
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
@arnold, yes but how to do it ?
Hence I ask in this forum.
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
ok, when I login to the client workstations, as local users and local administrators as well as the DOMAIN\Administrator I cannot remove the Print Queue:

[Window Title]
Remove Device

[Main Instruction]
This operation has been cancelled due to restrictions in effect on this computer. Please contact your system administrator.

[Content]
FollowMeLexmark on HQPRINTSVR01-VM

[OK]

Open in new window


So not sure how to delete it ?
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
I have no network printers here at home and I am out of office. I could try this in a VM, if you like and report what I did. Back in the day when we wanted to get rid of old printer connections, we used a logon script, that's all i know and it was pretty simple. I wrote it, so I will recall it.  Hang on.
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
Ah I see,

let me know when you are back in the office or have access to the script. I'll try it.
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Printui.exe /d * is the tool to use

The use of the older using rundll32.exe
https://support.microsoft.com/en-us/kb/189105

How were the printers originally deployed, often unsharing the printer...

Using GPO, GPP you can Deploy the new printers.

Test on one workstation first.
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
@Arnold,

When I tried to execute that myself in my laptop comd prompt as Administrator, I got this error

The Arguments are invalid.
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
Yes it is network printer connected to the same network and then shared by the print server in the AD.
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Lionel MMSmall Business IT Consultant
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
Thanks Lionel,

So can I use Group policy preference to delete or remove any type of network printer connection shared by the printer server only ?

Because there are about 87 printers in my building in total so I wonder do I need to creates 87 lines to delete it manually with exact names ?
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Lionel MMSmall Business IT Consultant
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
yes, taht is assuming the printer was deployed using the GPP.
But in my case here, the printer was deployed using the normal Computer Policies GPO.
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Lionel MMSmall Business IT Consultant
CERTIFIED EXPERT

Commented:
the Computer Policies GPO allows for the same functionality
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
Ah I see,

So is there any way to deploy the printer using the User Policies rather than Computer policies so that I don't have to target it based on Computer AD Object ?
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT

Author

Commented:
Thanks !

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.