Execute Applications on Remote Systems

.

Environment: NT4 SP6, Win 2000 SP1, Visual C++ 6.0

Overview

This program allows you to execute applications on remote systems without installing any client software. You can start a command prompt or just execute a command or exe  on a remote machine. The only restriction is you must be an administrator :(

Everybody knows the cool tools from Sysinternals (www.sysinternals.com). One of my favorites are PSEXEC, PSKILL and PSLIST,... :)
I was always wonder how they could query every kind of information or execute commands on a remote machine without installing any client software.

Features

  • With this program you can run as many remote commands on the remote machine as you want.  (PSEXEC supports only one remote command on the remote machine at the same time)
  • You can execute internal commands (dir,..) directly.
        xCmd.exe \\remote dir
  • You can start a light "telnet" connection with a remote machine without any telnet server
        xCmd.exe \\remote cmd

Usage

xCmd v1.0 for NT4/2000 - executes commands remotely
Freeware! 2001 Zoltan Csizmadia, zoltan_csizmadia@yahoo.com

Usage: xCmd.exe \\computer [options] command/exe arguments

Options:
    /D:directory         Set working directory
                         Default: Remote "%SystemRoot%\System32"
    /IDLE                Idle priority class
    /NORMAL              Normal priority class
    /HIGH                High priority class
    /REALTIME            Realtime priority class
    /C                   Copy the specified program to the remote machine's
                         "%SystemRoot%\System32" directory
                         Commands's exe file must be absolute to local machine
    /USER:user           User for remote connection
    /PWD:{password|*}    Password for remote connection
    /NOWAIT              Don't wait for remote process to terminate

Examples:
    xCmd.exe \\remote cmd
    xCmd.exe \\remote /user:administrator dir c:\
    xCmd.exe \\remote /user:somebody /pwd:* /d:d:\ test1.exe /p1 /p2 
    xCmd.exe \\remote /c /user:somebody /pwd:* /d:d:\ test2.exe /whatever

- Input is passed to remote machine when you press the ENTER.
- Ctrl-C terminates the remote process
- Command and file path arguments have to be absolute to remote machine
  If you are using /c option, command exe file path must be absolute to
  local machine, but the arguments must be absolute to remote machine

How does it work?

  1. The xCmd.exe is console application and when you start it, the program will extract a xCmdSvc.exe from its resources.
  2. xCmd.exe creates a service on the remote machine (that's the reason, you must be an administrator
  3. xCmd.exe starts the remote service (#2)
  4. xCmd.exe and xCmdSvc.exe will communicate via named pipes
  5. xCmd.exe send a packet to the service what to execute
  6. xCmdSvc.exe starts the command and redirect stdout, stderr, stdin to 3 named pipes. 
  7. xCmd.exe listens these 3 named pipes (#6), redirect them to its stdout, stderr, stdin

Notes

The executable is compiled and linked on Windows 2000 SP1, VC++ 6.0 SP4 and in multithreaded DLL mode.
So if you get some errors, rebuild your executable from the source (xCmd.dsw).

Downloads

Download source code and Executable - 27 KB

IT Offers

Comments

  • problem with console output

    Posted by yugiru on 06/25/2007 07:23pm

    Great program!! I have a little problem here. If I try to run a not pre-installed program/service on the remote machine(I wrote the program myself, just some console.write commands), I cannot see the console output from my local machine. Do you have any idea why?

    Reply
  • New version posted

    Posted by Rischip on 05/17/2007 12:32am

    The new version is on sourceforge.net. The project is "thegrimlinker" the download for the newest version is "ReXeCutioner"

    Reply
  • Problem with GUEST user

    Posted by Revolution on 07/11/2006 03:05am

    Hi everyone, When i try to use it in the XP SP2 machine the service could not able to start.If i change FORCEGUEST policy then the service starts. Have any solution this problem? please help.......

    Reply
  • xCmd Now working with GUI apps and running as user credentials

    Posted by Rischip on 02/07/2006 05:52pm

    I have added the functionality to run remote GUI apps using a new /interactive switch. Also run apps under the user credentials you provide on the command line (or /system switch will run as system account). This will allow you to have network access from the launched application. One thing to note using this approach; login scripts don't run when logging in this way. So drive mappings will most likely not exist. Also I can access UNC paths (i.e. \\server\share), but have not yet gotten NET USE syntax to work. Thanks to Zoltan Csizmadia for such good code to work with. Also thanks to Microsoft for some of the code I borrowed off of the MSDN library site. Email me at Edit 10/25/06 SORRY TOO MUCH SPAM@gmail.com to help me beta test. Added 4/19/06: These changes were added and are compatible specifically for users on a domain type setup. Not a work group. I am going to try and setup a project for this mod'd version on sourceforge.net 5/16/07: Look at "thegrimlinker" project on sourceforge.net. Go to downloads and download "ReXeCutioner" This is the newest version.

    • thanks

      Posted by MALEKY89 on 03/24/2010 01:51pm

      i read your code very nice code

      Reply
    • New version posted

      Posted by Rischip on 05/17/2007 12:31am

      The new version is on sourceforge.net. The project is "thegrimlinker" the download for the newest verision is "ReXeCutioner"

      Reply
    • xCmd Now working with GUI apps and running as user credentials

      Posted by Pippo BIMBO on 01/29/2007 06:25am

      Hi Rischip, Can you please share your xcmd with the intercative switch function please? TIA Thierry

      Reply
    • Re:xCmd Now working with GUI apps and running as user credentials

      Posted by Jemboy on 02/08/2006 02:35am

      Dear Rischip, could you please share your Xcmd with the interactive switch function?

      Reply
    Reply
  • problem with users

    Posted by machinito on 05/10/2004 06:32am

    To start an application in a remote machine you need to log in as an administrator, but when you remotely execute an application (ie. Internet Explorer) the task doesn't appear on the user screen but it appears on the task manager. What's wrong?

    • RE: problem with users

      Posted by kevmy21 on 12/12/2005 06:42pm

      The task will not display on the user's screen because it is being run in system space. The username you provide is only used to create a remote service. All services run in system space and do not display gui to users. The remote service executes the task.

      Reply
    Reply
  • remote GUI

    Posted by Legacy on 02/18/2004 12:00am

    Originally posted by: David Liouville

    Please could you give us a source code wich work with GUI applications ? built xCmd.exe with SERVICE_INTERACTIVE_PROCESS does nothing, wrong synthax ?
    Please help ...

    Reply
  • Problem with longer parameter for xcmd //server net start "Apache Tomcat 4.1"

    Posted by Legacy on 12/15/2003 12:00am

    Originally posted by: Marian

    Hi Gugus,
    I wave litle bit triky problem when I'm trying to use xcmd utility.
    I need it for stoping and starting services on remote machine in batch.
    xcmd works perfect when the name of the service has name without spaces (e.g. telnet...), but my problem had started, when I needed stop and start service named "Apache Tomcat 4.1". I used:
    xcmd //server net start "Apache Tomcat 4.1"
    and I get eror:
    NET START service
    I mean that xcmd sent command "net start + something"
    May pls. somebody help me get over this?

    What is triky, when I used it for first time it worked, but this was for first and last time.

    Best regards,

    Marian

    Reply
  • Windows XP Home Edition

    Posted by Legacy on 12/05/2003 12:00am

    Originally posted by: Eric Solinas

    Hi,

    Is this program suppose to work for accessing a Windows XP Home Edition computer?

    Thank's

    Eric

    Reply
  • can't execute batch files

    Posted by Legacy on 11/26/2003 12:00am

    Originally posted by: Alfonso

    Hello
    
    

    Wen I try to execute bach files on remote machines,
    the xcmd application show a error message.
    If I execute the commands step by step, It work fine.

    xcmd \\server1 c:\hola.bat
    xCmd v1.0 for NT4/2000 - executes commands remotely
    Freeware! 2001 Zoltan Csizmadia, zoltan_csizmadia@yahoo.com

    Connecting to remote service ... Ok

    Thank you.

    Alfonso

    Reply
  • Password Prompt Not Working Properly When Using Net Use Command

    Posted by Legacy on 11/20/2003 12:00am

    Originally posted by: Tester

    Hello.
    
    

    I am attempting to map a network drive on a remote machine and would like to be prompted for my password using the net use command, for security reasons.

    After typing:
    net use i: "\\goxsa397\scanners" * /USER:FPLNT\ixl0zgj

    I receive the prompt:
    Type the password for \\goxsa397\scanners:

    and about a second later, I automatically receive the following error message:

    System error 1326 has occurred.


    Here are my exact actions:

    C:\Pstools>xcmd \\ws069195 cmd
    xCmd v1.0 for NT4/2000 - executes commands remotely
    Freeware! 2001 Zoltan Csizmadia, zoltan_csizmadia@yahoo.com

    Connecting to remote service ... Ok

    Microsoft(R) Windows NT(TM)
    (C) Copyright 1985-1996 Microsoft Corp.

    C:\WINNT\system32>net use i: "\\goxsa397\scanners" * /USER:FPLNT\ixl0zgj
    net use i: "\\goxsa397\scanners" * /USER:FPLNT\ixl0zgj
    Type the password for \\goxsa397\scanners: System error 1326 has occurred.

    Logon failure: unknown user name or bad password.

    C:\WINNT\system32>

    Please assist.

    Thank You.

    • password

      Posted by oli730 on 05/07/2004 05:27am

      I have the same problem. If you solved your problem, please send me a mail on oliver@cit.kg.ac.yu. Thank you so much.

      Reply
    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Whitepapers and More

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds