strConnectString is only going to carry one value to the strResult…

 

You need to create a loop or do it one at a time. Also not a VBScript person but maybe

 

Set wshNetwork = CreateObject("WScript.Network")

wshNetwork.AddWindowsPrinterConnection "\\2k3dc\HP6"

 

Set wshNetwork = CreateObject("WScript.network")

wshNetwork.AddWindowsPrinterconnection \\2k3dc\HPSales

 

Setup each printer as a separate section. The problem is apparently that your AddWindowsPrinterConnections usees strConnectString and you are expecting it to hold two strings… it only holds one. So your second strConnectString line essentially overwrites the first. I think this is right.. It may not be the ‘best’ way to do it but it should work…

 

Kevin

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christine Allen
Sent: Tuesday, April 12, 2005 4:19 PM
To: '[email protected]'
Subject: [ActiveDir] VB Script and Group policy

 

Running Windows 2000 AD

 

I'm looking to automate the installation of printers using a vb script and group policy.  I found the script referenced below which works great for adding the printer and works great with GP.  However, I can only add one printer.  Every time I modify it to add additional printers it only adds one.

 

Set objWSHNetwork = CreateObject("WScript.Network") 'create network object
strConnectString = "\\servername\Boston_IT2"
strConnectString = "\\servername\Boston_IT"
strResult =objWSHNetwork.AddWindowsPrinterConnection(strConnectString)

 

Does anyone out there know a way of additional multiple printers with this script?  I should mention I am not a vb person.

 

Thanks

Reply via email to