Reply to Message

View discussion in a popup

Replying to:
BenLiebowitz
Expert
Expert

Script to list VM Network Adapter Type, exporting issue

Hi,

I wrote a PowerCLI script to list network adapters that are NOT VMXNet3.  The syntax works fine in PowerCLI however the Export-csv command is creating a 0k csv file.

Get-VM | Get-NetworkAdapter | Where-object {$_.Type -ne "Vmxnet3"} | foreach ($_) {Write-Host $_.Parent.Name "("$_.Name") type:" $_.Type} | export-Csv  c:\Network_Interface.csv -NoTypeInformation

Results look like:

VM1 ( Network adapter 1 ) type: Flexible
VM2 ( Network adapter 1 ) type: e1000

Any help would be appreciated.

- Ben

Ben Liebowitz, VCP vExpert 2015, 2016, & 2017 If you found my post helpful, please mark it as helpful or answered to award points.