Reputation: 1223
I've been trying to look up some documentation on jscript programming so I can write this by myself but getting no luck in finding the documentation required....
My problem is: I've been trying to write a jscript which would connect over a network and add printers.... Some of these networks have username and pw. So wasn't sure what to do now...
here is what i got till now
var WshNetwork = new ActiveXObject("WScript.Network");
var PrinterPath = "\\\\srvprint\LJ5_4";
WshNetwork.AddWindowsPrinterConnection(PrinterPath);
Any help would be appreciated. ty
Upvotes: 1
Views: 2913
Reputation: 31
Mine's slightly different and doesn't help with the password but, the way I do it is to set this at the start
dim varNetwork
Set varNetwork = CreateObject("WScript.Network")
then use this line for each printer
varNetwork.AddWindowsPrinterConnection "\\server\printer"
I use GP to set this to run in each user's start-up and just make sure their domain account has permissions to the printer.
Upvotes: 3