469,272 Members | 1,549 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,272 developers. It's quick & easy.

Replace batch-file with script?

Hi!

I have a batch-file (*.bat) which logon the client to our server, including
printer and drive mappings.

Now I want to replace the batch-file with a script for the windows scripting
host, because I want the users to enter their username and password, and
then the script should make the mappings suitable to the username...

I lookd for the WSH and VBSCRIPT and JSCRIPT, but I didn't get any usable
information!

Is it possible, to write such a script? Or does the WSH not support this
feature?

Thanks and greetings,
Christian.
Jul 23 '05 #1
1 1850
Christian-Josef Schrattenthaler wrote:
Hi!

I have a batch-file (*.bat) which logon the client to our server, including
printer and drive mappings.

Now I want to replace the batch-file with a script for the windows scripting
host, because I want the users to enter their username and password, and
then the script should make the mappings suitable to the username...

I lookd for the WSH and VBSCRIPT and JSCRIPT, but I didn't get any usable
information!

Is it possible, to write such a script? Or does the WSH not support this
feature?

Thanks and greetings,
Christian.


WSH has no mechanism for input, but that shouldn't be necessary. Simply make
your WSH script run _after_ the user logs into the workstation. They will
authenticate against whatever authentication mechanism you are using and then
the script can connect to the network resources.

To set up network drives and printers in WSH it would be something like:

-- logon.js --
var wshNetwork = new ActiveXObject("WScript.Network");
wshNetwork.MapNetworkDrive("Z:", "\\\\Server\\path\\to\\share");
wshNetwork.AddWindowsPrinterConnection("\\\\Server \\path\\to\\printer");

To test it, just use Start -> Run -> type "c:\path\to\logon.js" and hit Enter
(or run it from cmd or whatever)

All sorts of information about the WshNetwork object at <url:
http://www.devguru.com/Technologies/...shnetwork.html />

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Richard Wesley | last post: by
3 posts views Thread by Zack Sessions | last post: by
5 posts views Thread by Tyler Hudson | last post: by
2 posts views Thread by Paul Reddin | last post: by
12 posts views Thread by Selva Chinnasamy | last post: by
12 posts views Thread by tojigneshshah | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.