Command line tool to supply user name and password.

Posted on 2006-04-05
Last Modified: 2010-04-18

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.

Question by:Nick Sui
    LVL 4

    Accepted Solution

    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

    LVL 4

    Assisted Solution

    Check out psexec at

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
    Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now