Question : Enter a user name and password in a batch file

I am setting up an office with a Windows 2003 server on which I want to give access to the users to a home directory (F:) and a General directory.  The workstation are Win XP Home with existing users setup as the default user.  I have setup files and shares on the server using different user names than the users who are setup on the workstations.  I don't want to create new users on the workstations and then reinstall an setup their Destop and apps so the new user can use them.  I tried renaming the existing user to the user define on the server but when I try to connect to the shared directories Windows thinks that I am loggin in as the original Win XP user.  I created a batch file to run in the user's Startup folder that attemps to create drive letters pointing to the shared folders.  The batch file runs but asks for the user name and password (in the DOS screen.

Here is the batch file:
net use f: /delete
net use g: /delete
net use f: \\trmsrvr\billl /persistent:yes
net use g: \\trmsrvr\general /persistent:yes
exit

Is there a way to automatically enter the username and password (that the server will accept) so the user does not need to enter it.  

Thanks.

Answer : Enter a user name and password in a batch file

Beyondt,

Try modifying the batch file like this:
NET USE F: \\trmsrvr\bill password /USER:domainname\username /PERSISTENT:NO

I used to use something similar in batch files way back when, although honestly I don't remember just entering the password, but I've just checked the syntax of the NET USE command and that's what it's showing.  Also, you want persistent to be NO so your users don't get an error message logging on about the resource being in use.

Hope this helps,
Klancy

Random Solutions  
 
programming4us programming4us