Avatar of Senior IT System Engineer
Senior IT System EngineerFlag for Australia asked on

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

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.
Active DirectoryPrinters and ScannersMicrosoft Legacy OS

Avatar of undefined
Last Comment
Senior IT System Engineer

8/22/2022 - Mon
McKnife

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.
ASKER
Senior IT System Engineer

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.
SOLUTION
McKnife

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Senior IT System Engineer

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 ?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
McKnife

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.
ASKER
Senior IT System Engineer

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 ?
arnold

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..
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Senior IT System Engineer

@arnold, yes but how to do it ?
Hence I ask in this forum.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Senior IT System Engineer

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 ?
McKnife

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.
Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER
Senior IT System Engineer

Ah I see,

let me know when you are back in the office or have access to the script. I'll try it.
arnold

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.
ASKER
Senior IT System Engineer

@Arnold,

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

The Arguments are invalid.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Senior IT System Engineer

Yes it is network printer connected to the same network and then shared by the print server in the AD.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Senior IT System Engineer

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 ?
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Senior IT System Engineer

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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Lionel MM

the Computer Policies GPO allows for the same functionality
ASKER
Senior IT System Engineer

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 ?
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Senior IT System Engineer

Thanks !
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.