Can someone advise please or refresh, I have 2 clusters in my virtual centre and I want to list the Vm's, their OS and their IP addresses in these 2 clusters.
Can anyone advise please
Can you try this
Get-Cluster "cluster1","cluster2" | Get-VM | select Name,@{N="OS";E={$_.Guest.OSFullName}},@{N="IP addr";E={$_.Guest.IPAddress[0]}}
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
And if you want to include the clustername in the report, you can do
Get-Cluster "cluster1","cluster2" | %{ $cluster = $_ Get-VM -Location $cluster | ` select Name,@{N="Cluster";E={$cluster.Name}},@{N="IP addr";E={$_.Guest.IPAddress[0]}},@{N="OS";E={$_.Guest.OSFullName}} }
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I made a different solution based on the New-VIProperty cmdlet:
New-VIProperty -Name "OSFullname" -ObjectType VirtualMachine ` -Value { param($vm) $vm.Guest.OSFullName } -Force New-VIProperty -Name "IPAddress" -ObjectType VirtualMachine ` -Value { param($vm) $vm.Guest.IPAddress } -Force New-VIProperty -Name "Cluster" -ObjectType VirtualMachine ` -Value { param($vm) $vm.Host.Parent.Name } -Force Get-Cluster "cluster1","cluster2" | Get-VM | Select Cluster,Name,OSFullname,IPAddress
Regards, Robert