Is there a way to grab a list of the ‘physical’ NICs on a Virtual or physical machine that will report accurately with teamed NICs or ignore things like VPN created NICs?
It will just be working out a property that can define what exactly you’re after. For example in PowerShell 4.0 (8.1/WinServer 2012R2) or later you can use:
Get-NetAdapter -Physical
going back to older style (2.0/3.0) you can always use:
Get-WmiObject -class Win32_Networkadapter | Where {($_.PhysicalAdapter -eq $true)}
On my machine this still returns my VPN connection so I would need to create the criteria to filter this out. IE:
Get-WmiObject -class Win32_Networkadapter | Where {($_.PhysicalAdapter -eq $true) -and ($_.Manufacturer -eq 'Intel') }
Someone might know of some other property determine true physical adapters. Hoep this helps.
You could use the PNPDeviceID. If it starts with PCI, It’s plug n play is via the PCI bus and by association, hardware.
Get-WmiObject -class Win32_Networkadapter | Where {($_.PNPDeviceID -like 'PCI*')}
Ah thank both of you guys so much!