Sign in to follow this  
Followers 0
eds

How to Map a Network Drive with a Password

6 posts in this topic

Greetings All! :mellow:

I'm trying to write a script that will map a network drive (XP PC) that requires a user name and password. I also want it to save the username and password. I tried the DriveMapAdd function but it doesn't save the username and password on reboot.

So right now I'm running this command which works up to a point:

Run ("net use b: \\10.100.100.225\g /savecred /persistent:yes")

After several seconds of starting to run this, there is a command line prompt to enter the user, then after entering that, another prompt to enter the password.

How do I script for AuotIt to wait for these prompts and enter the specified data accordingly?

Thanks!

Share this post


Link to post
Share on other sites



Maby WinWaitActive() is what your looking for?


[spoiler]My UDFs: Login UDF[/spoiler]

Share this post


Link to post
Share on other sites

The net use command supports username and password. Open CMD and type Net Use /? or search in google for the correct syntacs

Share this post


Link to post
Share on other sites

Try this:

$usr = "administrator"
$pwd = "Test"
Run ("net use b: \\10.100.100.225\g /savecred /persistent:yes /user:" $usr & " " & $pwd)

Br,

UEZ

1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Unfortunately the above didn't work at all. Thanks for the suggestion. I found that Microsoft states that the net use command will not store a password permanently in the credentials manager. . It seems the only way a password is stored is when it is entered on the GUI interface

Edited by eds

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

If you don't use the /savecred switch it should work!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0