In this article we will use WMI Provider for Start a "Process on Remote Machine". You can use CreateProcess procedure, this procedure has verious parameters:
Some Useful Links
http://msdn.microsoft.com/en-us/library/system.management.invokemethodoptions.aspx
http://msdn.microsoft.com/en-us/library/Aa389388
- Computer Name
- Process Name
- UserName
- Password
Private Sub CreateProcess(ByVal strComputer As String, ByVal strProcess As String,ByVal UserName As String,ByVal Password As String)
Dim processBatch As ManagementClass = New ManagementClass("Win32_Process")
Dim inParams As ManagementBaseObject = processBatch.GetMethodParameters("Create")
Dim msc As ManagementScope
inParams("CurrentDirectory") = Nothing
inParams("CommandLine") = strProcess
Dim co As ConnectionOptions = New ConnectionOptions()
co.Username = UserName
co.Password = Password
Try
If (strComputer = System.Environment.MachineName) Then
msc = New Management.ManagementScope("\\" & strComputer & "\root\cimv2")
Else
msc = New Management.ManagementScope("\\" & strComputer & "\root\cimv2", co)
End If
msc.Connect()
processBatch.Scope = msc
Dim meyhodoptions As InvokeMethodOptions = New InvokeMethodOptions(Nothing, System.TimeSpan.MaxValue)
Dim outParamas As ManagementBaseObject = Nothing
outParamas = processBatch.InvokeMethod("Create", inParams, Nothing)
Catch ex As Exception
End Try
End Sub
Some Useful Links
http://msdn.microsoft.com/en-us/library/system.management.invokemethodoptions.aspx
http://msdn.microsoft.com/en-us/library/Aa389388