VMware Cloud Community
wamatha
Contributor
Contributor
Jump to solution

Powercli script to list cluster Name, Guest and Hostname in Cluster

Greetings,

I need Powercli script to list cluster Name, Guest and ESXi Hostnames in Cluster, then export to a csv file

Thanks

0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

I asume that you want the cluster name, guest and hostname for all your vm's. You can this information and export it to a .csv file as follows:

Get-VM |
Select-Object -Property @{N="VM";E={$_.Name}},
VMHost,
@{N="Cluster";E={$_.VMHost.Parent.Name}},
@{N="Guest";E={$_.Guest.OSFullName}} |
Export-Csv -Path VMInfo.csv -NoTypeInformation -UseCulture

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership
Jump to solution

I asume that you want the cluster name, guest and hostname for all your vm's. You can this information and export it to a .csv file as follows:

Get-VM |
Select-Object -Property @{N="VM";E={$_.Name}},
VMHost,
@{N="Cluster";E={$_.VMHost.Parent.Name}},
@{N="Guest";E={$_.Guest.OSFullName}} |
Export-Csv -Path VMInfo.csv -NoTypeInformation -UseCulture

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos