Click to See Complete Forum and Search --> : scripting runas/secondary logon
Shawn Brown
08-27-2002, 09:05 PM
Is it possible to script the runas command with a password. I would like to do this so I can compile some .exe's for application deployment. The information I have read so far says you can do a command line but it prompts for password. How do I pass the password and not get the password prompt.
Matt Winer
08-29-2002, 09:21 AM
Shawn,
There is a program that is part of the Windows 2000 resource kit called SU. Based off the unix version of su. Basicly you can run "su username" in a batch file and it would run the rest of the commands as that user. Now, by default su will prompt the user for a password. But you can do a
"su username < c:passwordfile.pwd" or something to that effect. That would take the contents of the password file and use it as the password. The problem with this is, you have to have your password plain text somewhere on the harddrive or the network.
Infact I found a SU readme on Swynk's site. http://www.swynk.com/trent/Articles/SUReadme.asp
Read the section: 3. Environment variable options AND 6. Avoiding password prompting
Hope that helps!
-Matt
------------
Shawn Brown at 8/27/2002 10:05:55 PM
Is it possible to script the runas command with a password. I would like to do this so I can compile some .exe's for application deployment. The information I have read so far says you can do a command line but it prompts for password. How do I pass the password and not get the password prompt.