Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Thread Tools Search this Thread
Old 05-05-2008
Join Date: May 2008
Posts: 10
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
Reply With Quote
Old 05-05-2008
Posts: n/a
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.
Reply With Quote
Old 05-05-2008
Join Date: Apr 2008
Posts: 2,139
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.
Reply With Quote
Old 05-05-2008
Join Date: Apr 2008
Posts: 163
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
Reply With Quote

  TechArena Community > Software > Software Development
Tags: ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads for: "Is it possible to run any .exe in the remote machine using WMI?"
Thread Thread Starter Forum Replies Last Post
Reading registry of remote machine using WMI Swati_here_2008 Software Development 4 22-03-2012 07:30 PM
How do you invoke a procedure from a remote machine ? Fragman Software Development 4 30-01-2011 03:29 AM
Running an MSI file on a remote machine brock_griffin@hotmail.com Windows Server Help 6 09-07-2010 04:36 AM
OS level of a remote machine GeforceUser Networking & Security 5 02-05-2009 06:20 PM
WMI to remote machine AndyS Windows Server Help 3 17-10-2007 07:42 PM

All times are GMT +5.5. The time now is 10:06 PM.