Trying to get all VMs use a provider. The issue is making the call from the provider to then get all the vApps - it cannot be made this way
Does anyone have a clean way of perfroming this action? ( A whole cluster (One of the many provider vDCs we have ) is going down, so i would like to generate a list.
Every Org has anywhere from 1-5 organization vDCs, so parsing it that way is a last resort in my book.
Thoughts? Suggestions?
$report = @()
$list = Get-ProviderVdc "Provider vDC" | get-civapp
foreach ($Vapp in $list){
$vms = $vapp | get-civm
foreach($vm in $vms){
if($vm) {
$vm | %{
$row = "" | select "name", "owner", "Email"
$row."name" = $_.name
$row."owner" = $vapp.Owner.FullName
$row."Email" = $vapp.Owner.Email
}
}
$report += $row
}
}
$report = $report | Sort-Object -Property Owner
$report | export-csv "C:\Vcloud-cluster-VMs.csv" -NoTypeInformation -UseCulture
Have you played with the Search-Cloud cmdlet?
Hi, here is how to get this report:
$report = Get-ProviderVdc "Provider vDC" | Get-OrgVdc | Get-CIVM | foreach {
$row = "" | select Name, Owner, Email;
$row.Name = $_.Name;
$row.Owner = $_.VApp.Owner.Name;
$row.Email = $_.VApp.Owner.Email;
$row
}
$report = $report | Sort-Object -Property Owner
$report | Export-Csv "C:\Vcloud-cluster-VMs.csv" -NoTypeInformation -UseCulture
Dimitar Milov
PowerCLI Team