Remove Network printer using WMIC

I' am currently trying to reset the printer preferences on our network printers, so that all the printers are set to print in black and white and that they are full duplex. The only way to configure this is to delete the printers on the print server and re-add them specifying the correct preferences before they are shared out again. The problem that I have is that the printers were not removed off the client machines when I deleted them and so the settings have remained the same as before they were configured to black and white and duplex.

I believe in order to be successful I need to removed the printer completely through GPO and then add it back in again. I've been looking at using WMIC for removing the printer, but I'm getting access denied on the client machines. Does anyone know why this might be and how I can get around it?

Thanks in advance for your assistance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi, run this as a logon script for your users, and it will remove any network printer, and re-add it.


Set objNetwork = CreateObject("WScript.Network")
Set colPrinters = objNetwork.EnumPrinterConnections
For intNum = 0 To colPrinters.Count - 1 Step 2
	If Left(colPrinters(intNum + 1), 2) = "\\" Then
		WScript.Echo "Removing and adding " & colPrinters(intNum + 1)
		objNetwork.RemovePrinterConnection colPrinters(intNum + 1)
		objNetwork.AddWindowsPrinterConnection colPrinters(intNum + 1)
	End If

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MartynLawsonAuthor Commented:
Thats worked great.

Thanks very much for your help
No problem. Thanks for the grade.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.