+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, Script to delete network printers at logoff? in Coding and Web Development; I'm looking for a reliable script to delete all network printers when a user logs off. Our users have roaming ...
  1. #1

    Join Date
    Mar 2011
    Location
    Norfolk, England
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Script to delete network printers at logoff?

    I'm looking for a reliable script to delete all network printers when a user logs off. Our users have roaming profiles and are currently picking up printers from every room they log into.
    We are running Server 2008 r2/Win7 and printers are being deployed by Print Management.
    Any help would be greatly appreciated.

    David

  2. #2

    Join Date
    Apr 2011
    Location
    North Wales
    Posts
    53
    Thank Post
    8
    Thanked 7 Times in 7 Posts
    Rep Power
    9
    We use vbscript to remove printers on logon, not sure if you could integrate the code with a shutdown script:

    Set wshNetwork = CreateObject("WScript.Network")
    on Error Resume Next

    'Deletes all network printers
    Set clPrinters = WshNetwork.EnumPrinterConnections
    On Error Resume Next
    For i = 0 to clPrinters.Count - 1 Step 2
    wshNetwork.RemovePrinterConnection clPrinters.Item(i+1), true
    Next

  3. #3
    daneil16's Avatar
    Join Date
    Jul 2012
    Location
    Norwich
    Posts
    21
    Thank Post
    9
    Thanked 3 Times in 3 Posts
    Rep Power
    5
    Just found this Microsoft reference for anyone else in a similar position

    https://gallery.technet.microsoft.co...nters-8b82b324

  4. Thanks to daneil16 from:

    Bento (9th October 2014)

SHARE:
+ Post New Thread

Similar Threads

  1. Script to delete profile at log off?
    By woody in forum Windows
    Replies: 74
    Last Post: 15th February 2013, 02:28 PM
  2. VB script to delete printers on logoff
    By jgcracknell in forum Scripts
    Replies: 10
    Last Post: 14th December 2009, 10:43 AM
  3. Replies: 8
    Last Post: 25th February 2009, 09:50 AM
  4. Replies: 7
    Last Post: 27th November 2005, 10:41 PM
  5. Script to delete printer
    By tosca925 in forum Scripts
    Replies: 2
    Last Post: 31st August 2005, 07:45 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
  •