Ad Code

Responsive Advertisement

How To Create Process on Remote Machine In Visual Basic

Dim oProcess As Object
Dim lProcessID As Long
Dim lRet As Long
Dim runstr As String
Dim RemoteHostName, ProcessName As String

RemoteHostName = "MyServer"

ProcessName = "mspaint.exe"

Try
runstr = "winmgmts:\\" & RemoteHostName & "\root\cimv2:Win32_Process"

oProcess = GetObject(runstr)
lRet = oProcess.Create(ProcessName, , ,IProcessID)
Catch errorVariable As Exception
MsgBox(errorVariable.Message)
End Try

There are certain issues like WMI and RPC must be enabled on remote machine and you must login with administrative rights etc.

Post a Comment

0 Comments