Command line tool to supply user name and password.

Hi,

Is there any command line tool available to supply user name and password on destination computer before executing  any command.

For Example:

I will be running : REG.EXE QUERY \\computer_name\HKLM\System\CurrentControlSet\Services /s > result.txt

I'm processing the above commnd in a script. Some servers are skipped because they need different user name and password. If any command line tool is available that can be used to establish the connection (not necessarily secure) with remote computer and then next (REG.EXE) command or available commands.

Thanks!
SystmProg
LVL 35
Nirmal SharmaSolution ArchitectAsked:
Who is Participating?
 
Nat_cCommented:
I think you can use the runas command

runas /user:domain\username "REG.EXE QUERY \\computer_name\HKLM\System\CurrentControlSet\Services /s > result.txt"

let me know if that works

Nat
0
 
averybCommented:
Check out psexec at sysinternals.com.  

http://www.sysinternals.com/Utilities/PsExec.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.