Another alternative is to hardcode the command, username and password in the script, then use the Script Encoder (download from to encode it.You run the script the same way, the file will just have a different extension: cscript The following command starts an instance of Notepad (and a file named my_file.txt) using a domain administrator account called jayj in a domain called domain.contoso.com: When prompted, type the domain administrator account password.This answer has been taken from:- Library/Get Html.asp?Additionally, it allows blank passwords to be used throughout the system.Lastly, the password is passed to Run As as plain text.Runas is a command-line tool that is built into Windows Vista.To use runas at the command line, open a command prompt, type runas with the appropriate parameters, and then press ENTER.
Updated: April 17, 2012Applies To: Windows Server 2003, Windows Vista, Windows XP, Windows HPC Server 2008 R2, Windows Server 2008, Windows 7, Windows Server 2003 R2, Windows Server 2000, Windows Server 2012, Windows Server 2003 with SP1, Windows 8Allows a user to run specific tools and programs with different permissions than the user's current logon provides.
Syntax RUNAS [ [/noprofile | /profile] [/env] [/savecred | /netonly] ] /user: User Name program RUNAS [ [/noprofile | /profile] [/env] [/savecred] ] /smartcard [/user: User Name] program Display the trust levels that can be used: RUNAS /showtrustlevels Run a program at a given Trust Level: RUNAS /trustlevel: Trust Level program Key /noprofile Do not load the user's profile.
This causes the application to load more quickly, but can cause some applications to malfunction. (default) /env Use the current environment instead of user's.
Unlike SU from the NT Resource Kit, you can't pass a password. You can use the following script to execute a command via RUNAS.
You might find this helpful for yourself, or run it from a batch file (although the password will be in clear text).