Reply to Message

View discussion in a popup

Replying to:
LucD
Leadership
Leadership

To get the IP addresses, provided there are multiple in a guest OS, in 1 property, you could do something like this

Get-VM |

Select Name,@{N='IP';E={[string]::Join(',',$_.Guest.IPAddress)}}

To get a separate row per IP address, you could do

foreach($vm in Get-VM){

    $vm.Guest.IPAddress |

    Select @{N='Name';E={$vm.name}},@{N='IP';E={$_}}

}

Both of these methods require the VMware Tools to be installed and the VM to be powered on


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference