Use of managementpath in vb.net

  • Thread starter Kim Skotte Larsen
  • 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top