hello, looking for a powercli script to help to get the list of VMs from a vCenter along with cluster name and vCenter.
format should be like this -
vCenter name - VM name - Cluster name
this output should be saved in a .csv format
TIA
Get-VM | ForEach-Object -Process {
New-Object -TypeName PSObject -Property @{
vCenter = ([System.Uri]$_.ExtensionData.Client.ServiceUrl).Host
Cluster = $cluster.Name
VM = $_.Name
}
} | Select vCenter, VM, Cluster |
Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Get-VM | ForEach-Object -Process {
New-Object -TypeName PSObject -Property @{
vCenter = ([System.Uri]$_.ExtensionData.Client.ServiceUrl).Host
Cluster = $cluster.Name
VM = $_.Name
}
} | Select vCenter, VM, Cluster |
Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks, but, it is not capturing the vCenter name. can you please have look
Corrected
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
its working as expected. thank you LucD