Hi there
I'm faily new to PowerCli and due to a lack of understanding this seems to fail in all forms.
I'm trying to list VM-name, NetworkName, Cluster, ESX Host
The aim is to export this and then create a new source file to use and set a new NetworkName for each vm on a per host base.
Please asssit me with this.
The Name and NetworkName works but fighting to add the cluster and Host
Thanks
Johan
Try it this way
Get-VM | Select @{N="VM";E={$_.Name}},
@{N="NetworkName";E={Get-NetworkAdapter -VM $_ | Select -ExpandProperty Name}},
@{N="Cluster";E={Get-Cluster -VM $_ | Select -ExpandProperty Name}},
@{N="ESX Host";E={Get-VMHost -VM $_ | Select -ExpandProperty Name}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try it this way
Get-VM | Select @{N="VM";E={$_.Name}},
@{N="NetworkName";E={Get-NetworkAdapter -VM $_ | Select -ExpandProperty Name}},
@{N="Cluster";E={Get-Cluster -VM $_ | Select -ExpandProperty Name}},
@{N="ESX Host";E={Get-VMHost -VM $_ | Select -ExpandProperty Name}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you LucD for the Super quick response and such a simple answer.
Sorry was a bit quick on the reply, but found the issue. Was looking for the NetworkName not Name.