I've got a peice of code to enumerate the MAC addresses and connection names of network cards.
Where a network connection name is not present, I want to set the string to some valid data (ie "Not present").
However, when I use the following code, I can't trap the empty data. Can anyone help?
Where a network connection name is not present, I want to set the string to some valid data (ie "Not present").
However, when I use the following code, I can't trap the empty data. Can anyone help?
Code:
Set colNICs = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter where AdapterType = 'Ethernet 802.3'")
For Each objAdapter in colNICs
strSystemName = objAdapter.SystemName
strMac = objAdapter.MacAddress
If objAdapter.NetConnectionID = "" then
strNetCon = "Not present"
Else
strNetCon = objAdapter.NetConnectionID
End if
strInner = strInner & "<td>" & strSystemName & "</td><td>" & strMac & "</td><td>" & strNetCon & "</td><tr>"
objExplorer.Document.Body.InnerHTML = strInner
Next