Solved

GPO, GPP, Script to remove network printer

Posted on 2014-02-19
12
2,527 Views
Last Modified: 2014-03-11
ok i know this question has been asked 1000's of times, however here is my issue.
i am trying to remove network printers with the above methods.  server is win2003, clients win7, without admin rights.

i have tried GPO, GPP and shutdown/startup scripts to remove the printers, nothing seems to work.  the printers werent installed with GP so removing them from deployed printers isnt an option.  i have no issues adding our new printers with GPO, GPP it is just removing the old ones.  i am testing on a machine with admin rights and still no luck.  if i run the script direct from the computer it works fine.  i have checked GPresult and my script is under computer config, in the right OU and has a recent update time.  it just doesnt seem to remove the printers.  i have been through all options in GPP and GPO.  none of those seem to work either.  i was able to remove a printer with GPO but had to put in the IP manually.  ticking the box to delete all IP printers didnt work.  any ideas what i could be missing?
0
Comment
Question by:rick81
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 12

Expert Comment

by:ktaczala
ID: 39872266
Above methods?  did you forget to attach the script?
0
 
LVL 6

Author Comment

by:rick81
ID: 39872269
haha if only it was the simple.  no, script attached.
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39872369
No, I mean you say you tried to remove with a script and it works when you insert IP address.  That's the script I was asking to see.

My last comment wasn't offering a solution, it was requesting the script.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:rick81
ID: 39872380
sorry i must not have explained myself correctly.

the script is basic,  removeprinterconnection \\server\printer vbs script.  works fine run from the desktop.  

the ip removal method was using GP Preferences to remove ip printers.  this didnt seem to work either.  if i put an individual ip printer it seemed to remove but couldnt do more than one and couldnt select remove all ip printers.  it just wouldnt remove them either.  at a loss with this.
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39872399
On Error Resume Next
 
strComputer = "."
   
Dim objNetwork
Set objNetwork = CreateObject("WScript.Network")
 ' ptr_server = your server, ptr_del is desired printer to delete. repeat for each printer
strPrintServer = "\\ptr_server\ptr_del"
If strPrintServer = ("\\ptr_server\ptr_del") Then
objNetwork.RemovePrinterConnection ("\\ptr_server\ptr_del")  


Is this similar to what you're using?
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39872415
Here's a link with a way of deleting all network printers without having to know the individual names of the printers.
http://blogs.technet.com/b/heyscriptingguy/archive/2007/11/02/hey-scripting-guy-how-can-i-remove-all-the-network-printers-on-a-computer.aspx
0
 
LVL 6

Author Comment

by:rick81
ID: 39872648
yep the scripting isn't the issue here as they work fine run from the desktop.  the issues is why i cant remove printers with GPO/GPP or a script at startup/shutdown, logoff, logon, etc.
and the computer i am testing from has full admin rights.  its a strange one.
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39872674
It's possible that the printers aren't mapped until after the script runs.
0
 
LVL 6

Author Comment

by:rick81
ID: 39872678
the printers have been manually installed though.  they are not re-mapping with a script or anything like that.  and i would have thought using GPP to remove and gpupdate/force would remove them.
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39873156
'try adding this into your startup script see if they are mapped, it should write
'to a file called output.txt

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("output.txt", True)

Set colInstalledPrinters =  objWMIService.ExecQuery(“Select * from Win32_Printer”)

For Each objPrinter in colInstalledPrinters

Printer = objPrinter.name

objFile.WriteLine "    " &  Printer

next
0
 
LVL 6

Accepted Solution

by:
rick81 earned 0 total points
ID: 39911946
i resolved this myself.  used a login script to remove network printers.  eventually seemed to work.  used GPO's to deploy new printers.  thanks
0
 
LVL 6

Author Closing Comment

by:rick81
ID: 39919986
resolved issue myself
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question