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
Solved

GPO, GPP, Script to remove network printer

Posted on 2014-02-19
12
2,411 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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 go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

792 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