Running commands on a remote computer.


Is there any command line tool availbale that can be used to run commands on a remote computer other than PSEXEC tool from Mark.

LVL 35
Nirmal SharmaSolution ArchitectAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There is the remote.exe command from Microsoft
part of the Windows tools but its a potential security hole so you should be VERY careful before implementing it.
Also a 3rd party utility BeyondExec
same caveats apply.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can also use SSH (Secure SHell) for Windows to securely run commands on remote computers.

Open Source SSH Server & Client for Windows:
Open Source SSH Client for Windows:
Nirmal SharmaSolution ArchitectAuthor Commented:
Thanks guys.

I will let you know shortly.
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Nirmal SharmaSolution ArchitectAuthor Commented:
Guys, its time to talk about this thread now.

Does this command work for anyone using Beyondexec.exe?

I have renamed Beyondexecv2.exe to bexe.exe

bexe.exe \\remote_computer reg.exe query "HKLM\Software\Microsoft\Updates\Windows Server 2003\SP1\"

The above command (reg.exe query) should list all the sub-keys under SP1 key but using Bexe.exe it doesn work. If I use the same account using PSEXEC.exe and it works fine.

I want to make it work with Bexe.exe (Beyond EXEc). Can this be done and why it doesn't work with BeyondEXEc and same command works with PSEXEC?

Nirmal SharmaSolution ArchitectAuthor Commented:
one more thing...if don't have a space in Key Name everything works fine!!!
Sounds like a bug in Beyond EXEc - it's not parsing the command line correctly and treating parameters encapsulated in quotes as a single parameter. Try doubling or tripling the quotes. ie:

bexe.exe \\remote_computer reg.exe query ""HKLM\Software\Microsoft\Updates\Windows Server 2003\SP1\""

bexe.exe \\remote_computer reg.exe query """HKLM\Software\Microsoft\Updates\Windows Server 2003\SP1\"""

Nirmal SharmaSolution ArchitectAuthor Commented:
Yes, it is.

Okay. How can you capture the error message supplied by the external command REG.exe. This command returns :

"Error: The specified registry key or value not found in registry"

I use file redirector (>) to capture the message but it captures only results supplied and if error, it simply shows the error message on command prompt.
Put " 2>&1" at the end of the line (after the redirection, and without the quotes).

Eg echo hello > file.txt 2>&1
Nirmal SharmaSolution ArchitectAuthor Commented:
Okay...can anyone run the below command let me know the results:

reg.exe query HKLM\Software\Microsoft\Updates\Windows Server 2003\SP1


reg.exe query "HKLM\Software\Microsoft\Updates\Windows Server 2003\SP1"

It says : Invalid Key name !

But the above key do exist in Registry.

I'm surprised if this bug is in reg.exe

That key doesn't exist on the system that I just tested, but a test on another key with a space in it works -

reg.exe query "HKLM\Software\Microsoft\Internet Explorer\Explorer Bars"

Running the command without the quotes fails with "ERROR: Invalid syntax"
Nirmal SharmaSolution ArchitectAuthor Commented:
REG.exe was corrupted.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.