NET USE command & network drives

Bienvenida Posted messages 80 Status Member -  
Bienvenida Posted messages 80 Status Member -
Hello,

I would like to map network drives using the NET USE command, which I will put into a .bat file and execute.
For example, I can map a user's personal drive by doing:
NET USE P: \\server\%username% /PERSISTENT:YES

The personal folder is located in a shared folder accessible to everyone, so there are no access rights issues.
However, I would like to map a folder that only an authenticated person can access. I can specify the user's login and password in a NET USE, but in that case, everyone can see the password in the command, so that's not acceptable.
I have been told that there is a command (or a NET USE parameter) called PROMPT, which prompts the user to enter their username and password. The password is then stored in the session's registry, and the user won’t have to re-enter their credentials.

Do you know how it works?

Thank you,

2 answers

JUHUDI DUPARC
 
The NET USE command

It is used in the login scripts of domain clients.

Here is its syntax:

NET USE L: \\SERVER\SHARE /PERSISTENT:NO

You will need to replace "SERVER" with the name of your server, and "SHARE" with the name of your share.

It is important to delete and recreate all network shares on every startup. To clear all shares, the following command is necessary:

NET USE * /DELETE /YES

Here is the complete example of a startup script:

NET USE * /DELETE /YES

NET USE Z: \\SERVER\SHARE1 /PERSISTENT:NO

NET USE U: \\SERVER2\SHARE2 /PERSISTENT:NO

Reminder: The script must be placed in the \\SERVER\NETLOGON directory. You need administrator rights to modify the contents of this directory.
26