Results 1 to 4 of 4

Thread: Is it possible to run any .exe in the remote machine using WMI?

  1. #1
    Join Date
    May 2008

    Is it possible to run any .exe in the remote machine using WMI?


    I have written the following program to run an executable in the remote machine.This is program runs fine when I try to execute process like calc.exe ot notepad.exe.But when i try to execute a. exe which is present in the local machine but not in the remote machine, the process doesn't execute in the remote machine.Please sugeest me.

    Option Explicit
    Dim objWMIService, objProcess
    Dim strShell, objProgram, strComputer, strExe, strInput
    strExe = "mywrittenexe.exe"
    ' Input Box to get name of machine to run the process
    strComputer = (InputBox(" ComputerName to Run Script",_
    "Computer Name"))
    If strComputer <> "" Then
    strInput = True
    End if
    Loop until strInput = True

    ' Connect to WMI
    set objWMIService = getobject("winmgmts://"_
    & strComputer & "/root/cimv2")
    ' Obtain the Win32_Process class of object.
    Set objProcess = objWMIService.Get("Win32_Process")
    Set objProgram = objProcess.Methods_( _
    objProgram.CommandLine = strExe

    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod( _
    "Win32_Process", "Create", objProgram)

    WScript.echo "Created: " & strExe & " on " & strComputer
    ' End of Example of a Process VBScript

  2. #2
    Yogesh Guest
    If you use TightVNC (freeware) you can control everything on the other computer. You see on your screen everything that is happening on the remote computer so you can monitor what the display look like.
    WindowsXP remote desktop is a pain because it requires a new log in on the remote computer after you have finished a session unless you are looking at Windows Server or the remote is WindowsXP 64 bit.

    Alternatively if the apps are written by you, you can talk to it with Winsock and instruct it to start any application on the remote machine. The Shell command goes in the remote app instead of your local one.

  3. #3
    Join Date
    Apr 2008
    If there's no user interaction required you should be able to launch the app remotely using WMI. The Win32_Process class is the one you want to investigate.

  4. #4
    Join Date
    Apr 2008
    Of course you can't use WMI to create an interactive process on currently supported systems. This includes any forms, minimized or otherwise, that are ever Shown. You might want to rethink that part.

    This was disabled for security reasons beginning with Win2K SP3, which I'm sure is what chroma was getting at. I suspect it is subject to Session 0 service isolation in Vista as well.

    Create Method of the Win32_Process Class

    The "conventional" way of doing this in VB6 would probably be to create an ActiveX EXE to run at the remote machine. Your local client would start and control it via DCOM.
    God is REAL... unless declared an INTEGER

Similar Threads

  1. Reading registry of remote machine using WMI
    By Swati_here_2008 in forum Software Development
    Replies: 4
    Last Post: 22-03-2012, 08:30 PM
  2. How do you invoke a procedure from a remote machine ?
    By Fragman in forum Software Development
    Replies: 4
    Last Post: 30-01-2011, 03:29 AM
  3. Running an MSI file on a remote machine
    By in forum Windows Server Help
    Replies: 6
    Last Post: 09-07-2010, 05:36 AM
  4. OS level of a remote machine
    By GeforceUser in forum Networking & Security
    Replies: 5
    Last Post: 02-05-2009, 07:20 PM
  5. WMI to remote machine
    By AndyS in forum Windows Server Help
    Replies: 3
    Last Post: 17-10-2007, 08:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts