Showing posts with label get-wmiobject win32_networkadapter;XP and Vista network interfaces. Show all posts
Showing posts with label get-wmiobject win32_networkadapter;XP and Vista network interfaces. Show all posts

Thursday, July 16, 2009

Vista and XP Network Interfaces with Powershell

In preparation for examing the differences between XP and Vista firewalls, I wrote this interesting Powershell CTP2.0 v3 script that exposes info for all physical and virtual network interfaces. More information is available on Vista than XP. This script will work on both. Each paragraph is a separate script.

.\Get-NetworkInterface.ps1

$Global:gwmiw32na = get-wmiobject win32_networkadapter
$gwmiw32na | fl *

$Global:gwmiw32na4 = get-wmiobject win32_networkadapter | Select Name,ServiceName,Speed,PhysicalAdapter
$Global:gwmiw32na6 = get-wmiobject win32_networkadapter | Select Name,PhysicalAdapter,MACAddress,Manufacturer,NetConnectionID
$gwmiw32na4 | ft -auto
$gwmiw32na6 | ft -auto

$gwmiw32na = get-wmiobject win32_networkadapter
$gwmiw32na | ? {$_.PhysicalAdapter} |Select Name,MACAddress,GUID,Description,Manufacturer,NetConnectionID,NetConnectionStatus
$gwmiw32na | ? {$_.PhysicalAdapter}

$adapter = Get-WmiObject win32_networkadapter
$adapter_count = $adapter.count
$adapter_range = ($adapter.count + 1)
write "Adapter Range= $adapter_range; Adapter Count= $adapter_count"
write .
write "Adapter Table:"
$AdapterNameID = $adapter | Select Name,DeviceID
$AdapterNameID