+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, Removing Dead Printers in Coding and Web Development; Morning all I am dealing with a school who have a messed up AD and printer solution. Managed to get ...
  1. #1
    TheRobins's Avatar
    Join Date
    Jan 2014
    Location
    Worcestershire
    Posts
    40
    Thank Post
    21
    Thanked 2 Times in 2 Posts
    Rep Power
    2

    Removing Dead Printers

    Morning all

    I am dealing with a school who have a messed up AD and printer solution.

    Managed to get that sorted, I'm just wondering if there is a script to remove "dead" printers.
    I know I can remove printers is I know the name and server they were shared from, however this is in such a state that some users have 15 old printer connections that have been removed. I was almost tempted to run along the lines of "server1/*.*" "server2/*.*" but not sure with printers whether that would work or what mayhem may start, Any Tips/Pointers would be most welcome

    Below is the SpiceWorks script I have used for a couple of years.

    Code:
    'Begin Script
    'Remember to edit the  printer address variables of strPrinter1 and strPrinter2 as well as the strComputer field
    strComputer = "."
    strPrinter1 = "\\server\Printer1"
    strPrinter2 = "\\server\Copier1"
    
    Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")  
      
    Set colPrinters = objWMI.ExecQuery("Select * From Win32_Printer")  
      
    For Each objPrinter in colPrinters  
      
    on error resume next  
      
    If Lcase(objPrinter.name) = Lcase(strPrinter1) Then  
      
    Set objNetwork = CreateObject("Wscript.Network")  
      
    objNetwork.RemovePrinterConnection strPrinter1  
      
    Else  
      
    If Lcase(objPrinter.name) = Lcase(strPrinter2) Then  
      
    Set objNetwork = CreateObject("Wscript.Network")  
      
    objNetwork.RemovePrinterConnection strPrinter2  
      
    End If  
      
    End If  
      
    Next
    'End Script

  2. #2

    nephilim's Avatar
    Join Date
    Nov 2008
    Location
    Dunstable
    Posts
    11,783
    Thank Post
    1,623
    Thanked 1,877 Times in 1,395 Posts
    Blog Entries
    2
    Rep Power
    422
    I would suggest remove all printers, then add them from scratch again

  3. Thanks to nephilim from:

    TheRobins (31st March 2014)

  4. #3
    TheRobins's Avatar
    Join Date
    Jan 2014
    Location
    Worcestershire
    Posts
    40
    Thank Post
    21
    Thanked 2 Times in 2 Posts
    Rep Power
    2
    All Printers have gone. I am now using Print Deployment in Server2008R2 which is working fine, its just the old remaining printers. I am going to try and log-off script to remove all printers and with GPO deployment it will sort itself out soon I hope.

  5. #4
    Joanne's Avatar
    Join Date
    Nov 2007
    Location
    Lancashire
    Posts
    1,504
    Thank Post
    116
    Thanked 112 Times in 104 Posts
    Blog Entries
    17
    Rep Power
    74
    I found that if you use group policy preferences to remove them, that works too.

    Create a new GPO, attach to users, then go to User Configuration | Preferences | Control Panel Settings | Printers right click, select new shared printer, then select delete and delete all printer connections.

    If you run this as the first one, you can then apply the printers you want afterwards.

    Hope this helps.

SHARE:
+ Post New Thread

Similar Threads

  1. Remove Dead Projects?
    By FN-GM in forum Comments and Suggestions
    Replies: 2
    Last Post: 18th May 2011, 01:16 PM
  2. Removing Network Printer
    By Little-Miss in forum Windows Server 2000/2003
    Replies: 11
    Last Post: 13th October 2010, 02:26 PM
  3. removing dead servers from backup exec
    By IanT in forum How do you do....it?
    Replies: 1
    Last Post: 11th February 2010, 09:21 PM
  4. Replies: 11
    Last Post: 20th November 2009, 01:07 PM
  5. Remove PDF Printers
    By EduTech in forum How do you do....it?
    Replies: 3
    Last Post: 22nd September 2008, 02:00 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •