Link to home
Start Free TrialLog in
Avatar of Albert Widjaja
Albert WidjajaFlag 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.
Avatar of McKnife
McKnife
Flag of Germany image

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.
Avatar of Albert Widjaja

ASKER

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
Avatar of McKnife
McKnife
Flag of Germany 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
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 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.
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 ?
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..
@arnold, yes but how to do it ?
Hence I ask in this forum.
SOLUTION
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
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 ?
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.
Ah I see,

let me know when you are back in the office or have access to the script. I'll try it.
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.
@Arnold,

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

The Arguments are invalid.
SOLUTION
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
Yes it is network printer connected to the same network and then shared by the print server in the AD.
SOLUTION
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
SOLUTION
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
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
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
SOLUTION
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
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.
SOLUTION
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
the Computer Policies GPO allows for the same functionality
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
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
SOLUTION
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
Thanks !