You need to run the line
 
strResult =objWSHNetwork.AddWindowsPrinterConnection(strConnectString)
 
between each printer you want to add. Doing it the way stated in the script you will first assign "\\servername\Boston_IT2" to the strConnectString and then before you have added the printer Boston_IT2 you remove the string and replace it with \\servername\Boston_IT before the  printer has been added, your script should look like this:
 
Set objWSHNetwork = CreateObject("WScript.Network") 'create network object
strConnectString = "\\servername\Boston_IT2"
strResult =objWSHNetwork.AddWindowsPrinterConnection(strConnectString)
strConnectString = "\\servername\Boston_IT"
strResult =objWSHNetwork.AddWindowsPrinterConnection(strConnectString)
 
And of course checking your return codes, maybe do some refactoring into a method called from a loop etc would be nice enhancements in the future if you intend to add a lot of printers.
 
Best Regards,
Thorbj�rn Sj�vold
Special Operations Software
www.specopssoft.com
thorbjorn.sjovold a t specopssoft.com

Specops Deploy,
Takes Group Policy Based Software Deployment to the next level

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christine Allen
Sent: Tuesday, April 12, 2005 10: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