I've a cluster with more than 1000 VM , Some of those VMs are power off due to lack of capacity
i need to list all powerdoff VMs and select the smallest disk sizeand power on this VM
Connect-VIServer vcsa.domain.local -User userl -Password password
$Report = @()
$VMs = Get-Cluster "Cluster" |
get-vm |Where-object {$_.powerstate -eq "poweredoff"}
foreach ($vm in Get-VM){ get-harddisk ??
how to compare between total disk size of all VMs to get the lowest disk size ?
Try something like this
Get-Cluster "Cluster" |
Get-VM |Where-object {$_.PowerState -eq "poweredoff"} |
Sort-Object -Property ProvisionedSpaceGB -Descending |
Select -First 1
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD
ProvisionedSpaceGB is not accurate , i used sum of HardDiskSizeGB and it worked fine.
another question if you could help
how can i enable logging for specifc VM before power it on ?
"... ProvisionedSpaceGB is not accurate"?
That depends what number you want to see?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference