+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, Removing Printers in Coding and Web Development; Hello! I've just started at a new school and ready for Monday I've been in for two days to see ...
  1. #1
    MaceZ4's Avatar
    Join Date
    Dec 2010
    Location
    Lots of different places...
    Posts
    129
    Thank Post
    12
    Thanked 12 Times in 8 Posts
    Rep Power
    10

    Cool Removing Printers

    Hello!

    I've just started at a new school and ready for Monday I've been in for two days to see what the system is like.
    I've been asked by a number of teachers if there's a way to clean up the printer's list on ALL the computers...

    There has been a large number of support contractors in before they hired me and print servers have come and gone, but the traces of the printers attached to their names haven't...

    Is there a script that will just remove every printer on the list, I've seen a couple that requires knowing the name and location of the printer/share...

    I can then set the system to remove printers on log in for a few weeks at the start of term and get a printer deployment sorted out to help tidy up...

  2. #2
    mhundley's Avatar
    Join Date
    Oct 2007
    Location
    Worcester
    Posts
    47
    Thank Post
    11
    Thanked 8 Times in 7 Posts
    Rep Power
    16
    Hi,

    It depends on how your system is set up, assuming these computers are on the domain and you are using Group Policy then you may be be in luck, if you have access to Client Side Preferences then you can tell it to remove all printers.

    To do this navigate to the users preferences section and select new printer, when you get the dialogue box change the create option to delete and further down tick the checkbox for delete all printers.

    There is loads of info on setting up printers with GPO Preferences at this site Grouppolicy.biz

    If you are set on/stuck with using logon scripts then that can also be done, I have chopped a few bits out of a vbs logon script we used to use before preferences, I think this will be complete but have not tested it.

    Code:
    On error resume next
    Dim objNetwork, oP, lgCnt
    Set objNetwork = CreateObject("Wscript.Network")
    
    Set oP=objNetwork.EnumPrinterConnections
    lgCnt=oP.Count
    Do While lgCnt>0
     objNetwork.RemovePrinterConnection oP.Item(lgCnt-1),True,True
     lgCnt=lgCnt-2
    Loop
    As i have said this is chopped from another script which I have successfully used in several schools, however I have lost the original source for the script so cannot publish the whole thing out of respect for the original author.

    My understanding of how the script works is that it looks for all network printer connections and instead of needing to know the name it simply gives it a value, the loop simply removes the printer found at an decreasing value working from the last to first printer.

    Give that a try and if you need any more help/my script is missing a bit (entirely likely as I am away from the proper code) please feel free to reply and we will see what we can do for you.

  3. #3

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    To do this navigate to the users preferences section and select new printer, when you get the dialogue box change the create option to delete and further down tick the checkbox for delete all printers.
    Seconded and when that works, throw away whatever made the original mess, leave that delete-all GPP entry there in #1 position and add new ones to deploy the printers...but endeavour to keep the targeting consistent/comprehensible - with great power comes great responsibility etc.

  4. #4

    Join Date
    Jan 2010
    Posts
    101
    Thank Post
    0
    Thanked 7 Times in 7 Posts
    Rep Power
    11
    we use kix scripts to handle and clear printers from real machines

    andy

SHARE:
+ Post New Thread

Similar Threads

  1. Removing printers deployed by group policy
    By FN-GM in forum Windows
    Replies: 15
    Last Post: 8th October 2011, 11:53 AM
  2. Replies: 11
    Last Post: 20th November 2009, 01:07 PM
  3. Setting Printers Based On Room Location
    By ICTNUT in forum Scripts
    Replies: 34
    Last Post: 13th May 2006, 08:19 PM
  4. Removing printers
    By RobC in forum Scripts
    Replies: 23
    Last Post: 7th March 2006, 02:30 PM
  5. A3 Printers Recommedations
    By mrtechsystems in forum Hardware
    Replies: 7
    Last Post: 13th July 2005, 09:37 AM

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
  •