Exporting Hyper-V Client IP Address Details to a CSV

Took a file to figure out the correct syntax — the following line will export all of the primary IP Addresses along with the name and mac address in a single PS command

Get-VM | ?{$_.ReplicationMode -ne “Replica”} | Select -ExpandProperty NetworkAdapters | ? IPAddresses -ne $null | % { [PSCustomObject]@{ Name=$_.VMName;IPAddress=$_.IPAddresses[0];MacAddress=$_.MacAddress; } }

 

Leave a Reply

Close Menu