In PowerShell v3 we’ve got a new cmdlet: Get-NetAdapter.
So, what can we do with this?
First, what output does this cmdlet give us?
So could you use the help feature in PowerShell to get a view of the possible parameters and syntax this cmdlet offers?
Command: Get-Help Get-NetAdapter
As you can see, there is a –IncludeHidden parameter which include any hidden network adapters in your output:
Command: Get-NetAdapter –IncludeHidden
But there also is a –Physical parameter which will only include physical network adapters in your output?
Command: Get-NetAdapter –Physical
So what if you want to get the virtual network adapters instead of the physical?
Well, there isn’t a cmdlet included for that, so you can simply filter on the property value, right?
Command: Get-NetAdapter | Where {$_.Virtual –eq $True}
You can also easily filter on the description by using the –InterfaceDescription parameters.
For example… let’s get all the network adapters with “Hyper-V” in the description?
Command: Get-NetAdapter –InterfaceDescription “*Hyper-V*”
Here is how you get some basic information about the driver which is used by the adapter
Command: Get-NetAdapter | select name, drivername, majordriverversion, minordriverversion, driverinformation
And to get information about the linkspeed and such?
Command: Get-NetAdapter | select vlandid, promiscuousmode, portnumber, networkaddress, permanentaddress, mediatype
And the last one in the category of information gathering, to get some information about the state and capabilities of the network adapter?
Command: Get-NetAdapter | select transmitlinkspeed, physicalmediatype, mediaconnectionstate, speed, requestedspeed, maxspeed, fullduplex, linkspeed
How can I use this to get driver information on 500 computers. Would it just be a import-csv syntax and then this cmdlet?
Not exactly since the Get-NetAdapter cmdlet doesn’t have a ComputerName parameter.
However, it does have a CimSession parameter so you could do something like:
$Computers = Import-CSV -Path D:\MyComputers.csv | Select-Object -ExpandProperty ComputerName
$CimSession = New-CimSession -ComputerName $Computers
Get-NetAdapter -CimSession $CimSession