Saturday, December 27, 2008

SCRIPT: Read the GUID of network card

Query to determine the GUIDs of your network adaptors:

Dim IPConfigSet
Dim strNIC
Dim CRLF

CRLF = CHR(10) & CHR(13)
' Perform a WMI query to obtain information about the network adaptors that are bound to IP and that have a physical MAC address.

Set IPConfigSet = _
GetObject("winmgmts:").ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where ((IPEnabled = TRUE) And (MacAddress != NULL) And (SettingID != NULL))")
' Enumerate the results (list of NICS).
For Each IPConfig In IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
strNIC = _
"Caption: " & IPConfig.Caption & CRLF & _
"Description: " & IPConfig.Description & CRLF & _
"NIC GUID: " & IPConfig.SettingID
For i = LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress)
strNIC = strNIC & CRLF & "IP Address (" & CStr(i) & "):" & IPConfig.IPAddress(i)
Next 'i
Wscript.Echo strNIC
End If
Next 'IPConfig

http://support.microsoft.com/kb/896073

2 comments:

Anonymous said...

lol,so nice

Anonymous said...

It seems my language skills need to be strengthened, because I totally can not read your information, but I think this is a good BLOG