Use of managementpath in vb.net

  • Thread starter Thread starter Kim Skotte Larsen
  • Start date Start date
K

Kim Skotte Larsen

Hi,

I'm trying to connect to a specific instance of a WMI Class via the
System.Management namespace.

I have complied this code snippet to reproduce the error:

Imports System.Management
Module Module1
Sub Main()
Dim mgrObj As New ManagementObject()
mgrObj.Path = New ManagementPath("Win32_Process.Name=""notepad.exe""")
Console.WriteLine(mgrObj("ProcessID"))

End Sub
End Module

(notepad.exe is running while I test the code)

When I try to access the ProcessID property of the ManagementObject I get a
System.Management.ManagementException: Invalid parameter

/Kim Skotte Larsen
Herning Kommune
 
Back
Top