Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

GPO, GPP, Script to remove network printer

Posted on 2014-02-19
12
Medium Priority
?
2,767 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 13

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 13

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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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 13

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 13

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 13

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 13

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
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…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

688 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