I need to run application on a remote machine. I have this code in VB 6 but, can't seem to get it working in VB.NET (windows 2000 network).
Dim strComputer As String
Dim objWMIService As Object
Dim errReturn As Long
Dim intProcessID As Long
strComputer = "dev2"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process"
errReturn = objWMIService.Create("notepad.exe", Null, Null, intProcessID)
If errReturn = 0 Then
MsgBox "notepad.exe was started with a process ID of " _
& intProcessID & "."
Else
MsgBox "notepad.exe could not be started due to error " & _
errReturn & "."
End If
Dim strComputer As String
Dim objWMIService As Object
Dim errReturn As Long
Dim intProcessID As Long
strComputer = "dev2"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process"
errReturn = objWMIService.Create("notepad.exe", Null, Null, intProcessID)
If errReturn = 0 Then
MsgBox "notepad.exe was started with a process ID of " _
& intProcessID & "."
Else
MsgBox "notepad.exe could not be started due to error " & _
errReturn & "."
End If