Replace batch-file with script?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christian-Josef Schrattenthaler

    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.


  • Grant Wagner

    #2
    Re: Replace batch-file with script?

    Christian-Josef Schrattenthaler wrote:
    [color=blue]
    > 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.[/color]

    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.MapN etworkDrive("Z: ", "\\\\Server\\pa th\\to\\share") ;
    wshNetwork.AddW indowsPrinterCo nnection("\\\\S erver\\path\\to \\printer");

    To test it, just use Start -> Run -> type "c:\path\to\log on.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 <gwagner@agrico reunited.com>
    comp.lang.javas cript FAQ - http://jibbering.com/faq


    Comment

    Working...