Я для таких целей использовал WMI класс Win32_Process
- Код: Выделить всё
Public Class WMIProcess
' класс для запуска процесов
Enum PriorityEnum
Normal = 32
Idle = 64
Hight = 128
RealTime = 256
BelowNormal = 16384
AboveNormal = 32768
End Enum
Enum ShowWindowEnum
SW_Hide = 0
SW_Normal = 1
SW_ShowMinimized = 2
SW_ShowMaximized = 3
SW_ShowNoActivate = 4
SW_Show = 5
SW_Minimize = 6
SW_ShowMinNoActivate = 7
SW_ShowNA = 8
SW_Restore = 9
SW_ShowDefault = 10
SW_ForceMinimize = 11
End Enum
Public ProcStartInfo As Management.ManagementClass
Function GetStarupInformation(ByVal Priority As PriorityEnum, _
ByVal ShowWindow As ShowWindowEnum) _
As Management.ManagementClass
Dim ProcStart As New Management.ManagementClass("Win32_ProcessStartup")
ProcStart.CreateInstance()
ProcStart.SetPropertyValue("PriorityClass", _
Priority)
ProcStart.SetPropertyValue("ShowWindow", _
ShowWindow)
ProcStartInfo = ProcStart
Return ProcStart
End Function
Public Function CreateProc(ByVal CommandLine As String, _
ByVal Compname As String, _
Optional ByVal UserName As String = Nothing, _
Optional ByVal Password As String = Nothing, _
Optional ByVal CurDirectory As String = Nothing, _
Optional ByVal ProcStartInfo _
As Management.ManagementClass = Nothing)
Dim Proc As New Management.ManagementClass("Win32_Process")
Dim Scope = New Management.ManagementScope()
Scope.Options.Username = UserName
Scope.Options.Password = Password
Scope.Path.Server = Compname
Proc.Scope = Scope
Dim InPars As Management.ManagementBaseObject
Dim OutPars As Management.ManagementBaseObject
InPars = Proc.Methods("Create").InParameters
InPars.SetPropertyValue("CommandLine", _
CommandLine)
InPars.SetPropertyValue("CurrentDirectory", _
CurDirectory)
InPars.SetPropertyValue("ProcessStartupInformation", _
ProcStartInfo)
OutPars = Proc.InvokeMethod("Create", _
InPars, _
New Management.InvokeMethodOptions)
Return OutPars("ProcessId")
End Function
End Class
Вот только приложение запуститься в фоновом режиме, это только для удаленной машины, на локальной можно использовать флаги ShowWindowEnum.
И еще для всего этого на целевой машине должен быть разрешен 135 порт.