Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Delete All Printer Connections.

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,56708
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Delete All Printer Connections.
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Delete All Printer Connections. - 2/14/2008 10:51:24 PM   
  zagadka

 

Posts: 4
Score: 0
Joined: 2/14/2008
Status: offline
Hi there,

I'm pretty new to Vbscript so if I sound like a n00b...I am.

I'm working on a couple of little thing at the moment, I will post the other ina seperate thread.

Firstly though, I am working on a way to distribute shared printers to different departments.

I've got the distribution bit working OK in a closed system, but as the current users will already have local and shared printers installed I would like to clear them all off at the start of the script and then apply the new printers afterwards.

Here is my add printer script:


Option Explicit
Dim objNetwork, strLocal, strUNCPrinter1, strUNCPrinter2

strUNCPrinter1 = "\\ultra-invu\Accounts C2620"
strUNCPrinter2 = "
\\ultra-invu\Accounts HP2430"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
objNetwork.AddWindowsPrinterConnection strUNCPrinter2
objNetwork.SetDefaultPrinter strUNCPrinter1

 

I am not sure what to do next though as I have not found anything useful as yet to get both the local and shared printers to be removed together.

If anyone knows of how this can be done, please can you post an example script! I'd be very grateful!
 
 
Post #: 1
 
 RE: Delete All Printer Connections. - 2/15/2008 5:30:59 AM   
  Country73


Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
Delete Printers:

      

(in reply to zagadka)
 
 
Post #: 2
 
 RE: Delete All Printer Connections. - 2/17/2008 11:38:31 PM   
  zagadka

 

Posts: 4
Score: 0
Joined: 2/14/2008
Status: offline
Thankyou very much for the reply.

I'm probably being blind/stupid but I cannot seem to get this to work.

I have tried putting the script before my add printer script and it errors. I put the script into its own .vbs to run it fails to do anything.

Are there are editable areas of the script I need to configure to add to my Add Printers script and do I need to have any specific programs installed on the local PC beforehand?

I still have much to learn :(

(in reply to Country73)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Delete All Printer Connections. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts