We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Running commands on a remote computer.

Nirmal Sharma
Medium Priority
Last Modified: 2012-08-14

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

Watch Question

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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
You can also use SSH (Secure SHell) for Windows to securely run commands on remote computers.

Open Source SSH Server & Client for Windows: http://sshwindows.sourceforge.net/
Open Source SSH Client for Windows: http://www.chiark.greenend.org.uk/~sgtatham/putty/
Nirmal SharmaSolution Architect
Top Expert 2005


Thanks guys.

I will let you know shortly.
Nirmal SharmaSolution Architect
Top Expert 2005


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 Architect
Top Expert 2005


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 Architect
Top Expert 2005


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 Architect
Top Expert 2005


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 Architect
Top Expert 2005


REG.exe was corrupted.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.