to add username & password into my login.cmd - login script

Discussion in 'Scripting' started by sphilip, Feb 27, 2008.

  1. sphilip

    sphilip Guest

    @echo off
    REM filename: logon.cmd
    echo Hello %username%
    echo You are now logged into %computername%
    echo Now setting up your computer for network access.

    echo Connecting Network Drive
    net use q: /DELETE
    net use q: \\MUDONSTRGSRV\mace /PERSISTENT:YES
    net use f: /DELETE
    echo Done.

    The above is a logon script that we r using in our network. Please can
    someone give me an idea on how to add user access rights into this script.

    When we run this script it keeps asking for username & password. Is there a
    way I can add the username & password in this script itself so that users (
    workgroup ) can do without entering username & password.

    Thank You.
    sphilip, Feb 27, 2008
    1. Advertisements

  2. Make sure that the user's account/password is defined on \\Mudonstrgsrv
    so that your users don't get challenged for their identity.

    A user cannot grant himself access rights, unless he is an
    administrator. If he could, what would be the purpose of
    access restrictions?

    If you use a logon script to map your shares then you don't
    need persistency. Having it on is counterproductive. Code
    it like so instead:

    net use X: \\server\share /persisten:no
    Pegasus \(MVP\), Feb 27, 2008
    1. Advertisements

  3. it is not secure to store usernames and passwords in a script. everyone can
    see it.

    it would be best in your workgroup situation to have the usernames and
    passwords identical on all machines. this is a headache, but that's why you
    should use a domain.
    if you setup user accounts on the workstations and your server with
    identical usernames and passwords, no credentials are asked.

    if, however you STILL want to do it, use the syntax:
    net use f: \\mudonstrgsrv\ftp UserName1 [email protected]
    where UserName1 and [email protected] are the username and password respectively.
    now the script won't ask for credentials anymore, but as said before, it is
    not secure and surely not recommended. there are better ways..

    Ben van Zanten
    Zanten, Ben van, Feb 28, 2008
  4. Please try to reply to the OP in future threads, unless you're
    referring to my own response.
    Pegasus \(MVP\), Feb 28, 2008
  5. sphilip

    Al Dunbar Guest

    Or, if this is a domain environment, make sure that the shares and
    underlying folders are permitted such that they will be accessable to all
    those who need the access.

    Al Dunbar, Mar 5, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.