Reputation: 13
So I need to write a script to map 60 printers for about 20 users on RDS. Problem is the script is only mapping printers to line 14, but it's running until the last line. I know it's runnign to the last line because the last line is: a=msgbox("All printers are mapped. Default printer is set. Click OK to close. Scripting by Nick, donations welcome.")
All humor aside, I was trying to find a way to break my script into multiple scripts with one script calling the rest. If someone has a better idea I'm all eyes! But here's a sample of the code I'm using:
Dim Net Set objNetwork = Wscript.CreateObject("Wscript.Network") objNetwork.AddWindowsPrinterConnection "\printserver\printer name1", "domain\admin", "password" objNetwork.AddWindowsPrinterConnection "\printserver\printer name1", "domain\admin", "password" objNetwork.AddWindowsPrinterConnection "\printserver\printer name1", "domain\admin", "password" objNetwork.AddWindowsPrinterConnection "\printserver\printer name1", "domain\admin", "password" objNetwork.AddWindowsPrinterConnection "\printserver\printer name1", "domain\admin", "password"
Upvotes: 1
Views: 1698
Reputation: 3111
runas /user: <username> cscript.exe yourscript.vbs
or
psexec -u <username> -p <password> cscript.exe yourscript.vbs
http://technet.microsoft.com/en-us/sysinternals/bb897553
Upvotes: 1