How can I automate re-mapping of shares after a password change?
Posted on 2013-01-22
Okay, so here's the scenario:
Non-domain Windows 7 computer, accessing AD domain shares with a valid AD account.
Shares are mapped with the "use other credentials" option.
Now when the user has to change p/w for the domain, the computer is still storing the users old credentials. So after the password change, the computer still tries to pass the old credentials and this locks out the users account due based on the 3 bad attempts security feature in AD.
* Note, I have no control over the AD settings for the domain where this PC is stationed.
While I could probably create a walk-through for the users to disconnect and re-map their shares, I would prefer to automate this if I can.
* if there is a better way than the following to deal with the situation then let me know.
So my current train of thought is to try and use some batch files to simplify the process.
I know I can use NET USE to delete and then re-map the shares, but I'm not sure how to pass the new password to the commands.
My understanding of the NET USE command is that unless you specify the credentials, it will attempt to pass current logged on user creds, and if they don't match the domain, it fails, so it will not prompt for valid (new) creds.
I'm thinking there is a way to ask for and pass the new password to the batch file, but I can't find what it is. My programming skills are very low, sorry.
I've seen several variations on scripts that ask for input and then put that into a variable, but I'm not seeing how I safely insert it into the middle of a command.