I had some batch scripts that needed to access remote shares. In order to not have to leave the clear text password in the batch files you must do the following:
- Run batch script under user with same username and password as a user on the remote system
- Ex: Machine A user "MachineA\sameUsername" and Machine B user "MachineB\sameUsername"
- Ex: Machine A user "MY-DOMAIN\sameUsername" and "DIFF-DOMAIN_BUT_SAME_NAME_PASSWORD\sameUsername
- Execute the NET USE command without the password specified
- Ex: NET USE \\10.1.1.2 /USER:DIFF-DOMAIN\sameUsername
This works because even though you have different domains or machine names Windows will still try the same password if both machines have users with the same usernames. I used this to map resources on a separate domain that didn't have a domain trust to the first domain.