Solved

GPO, GPP, Script to remove network printer

Posted on 2014-02-19
12
2,272 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
  • 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
 
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now