Hi,
Im trying to pull out some network adapter settings, this is my script:
$colAdapters = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For $objAdapter in $colAdapters
If Not ($objAdapter.IPAddress) = " " Then
ConsoleWrite (" ID: " & $objAdapter.NetConnectionid& @CR)
ConsoleWrite (" Physical (MAC) address: " & $objAdapter.MACAddress& @CR)
ConsoleWrite (" IP Address : " & $objAdapter.IPAddress(0)& @CR)
ConsoleWrite (" IP Subnet : " & $objAdapter.IPSubnet(0)& @CR)
ConsoleWrite (" IP Default Gateway : " & $objAdapter.DefaultIPGateway(0)& @CR)
ConsoleWrite (" IP DNS1 : " & $objAdapter.DNSServerSearchOrder(0)& @CR)
ConsoleWrite (" IP DNS2 : " & $objAdapter.DNSServerSearchOrder(1)& @CR)
EndIf
Next
EndFunc
The only one not working is 'NetConnectionid' which should bring back the name of the adapter is it appears in network and sharing centre, in my case this is 'Local Area Connect' but it is not returning anything. Anyone got any ideas?