471,595 Members | 955 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,595 software developers and data experts.

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 1903
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
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.