Bastian

Bastian

  • NA
  • 3
  • 0

Problems Getting MAC Adress

May 21 2007 3:59 PM

Hi,
I need to check the MAC Adresses on my Computer.
I use the follwoing code and get alwys the follwing Error "error: cannot obtain value"

Dim
strtemp As String

Dim bReturnValue As Boolean = True

Dim query As New SelectQuery("Win32_NetworkAdapter")

'ManagementObjectSearcher retrieves a collection of WMI objects based on

' the query.

Dim search As New ManagementObjectSearcher(query)

' Display each entry for Win32_bios

Dim info As ManagementObject

For Each info In search.Get()

strtemp = info("MacAddress").ToString()

If strtemp = MacAddress Then

bReturnValue = True

Exit For

End If

Next

I have no clue what the problem could be, Any good ideas?

Thanks

Bastian


Answers (2)