Hi,
is it possible to get the information of a VM on which VCenter the VM´s belongs?
I´m asking, because we have more vcenters....
connection to more vcenters example
$vmlist = get-vm | sort name
$myCol = @()
foreach ($vm1 in $vmlist)
{
$vminfo = $vm1 | Select name, Powerstate, NumCPU, MemoryGB,
@{N="OS";E={$_.extensiondata.config.GuestFullName}},
@{N="Cluster";E={$_.vmhost.parent}},
@{N='vCenter';E={$_.get-viserverorsomethinglikethisName}} # how can i get the vcenter back from the vm object?
$myCol += $VMInfo
}
$mycol
Try like this
@{N = 'vCenter'; E = { ([uri]$_.ExtensionData.Client.ServiceUrl).Host } },
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this
@{N = 'vCenter'; E = { ([uri]$_.ExtensionData.Client.ServiceUrl).Host } },
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
perfect!
thanks Luc