Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 180259

How to export into a CSV VMs that are powered on in a cluster

$
0
0

Hello I have the following code but exports all VM that are powered on and off. Is there anyway to export only the VMs that are powered On ?

 

$clusterName = "Whatever"

Get-Cluster -Name $clusterName | Get-VM | Select Name, @{N="Cluster";E={$clusterName}}, @{N="ESX Host";E={Get-VMHost -VM $_ | Select -ExpandProperty Name}}, @{N="Datastore";E={Get-Datastore -VM $_ | Select -ExpandProperty Name}} |Export-Csv C:\report.csv -NoTypeInformation -UseCulture

 

Thanks,


Viewing all articles
Browse latest Browse all 180259

Trending Articles