| ||Thread Tools||Search this Thread|
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.
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",_
If strComputer <> "" Then
strInput = True
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
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.
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.
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
|Tags: remote machine, wmi|
|Thread Tools||Search this Thread|
|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 02:29 AM|
|Running an MSI file on a remote email@example.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|