Hi All,
Can anyone please let me know how to list the powered off VMs from vCenter for specific period using PowerCLI.
Thanks in advance…
-Jithin
Try something like this
$vms = Get-VM
Get-VIEvent -Start (Get-Date).AddDays(-7) -Entity $vms -MaxSamples [int]::MaxValue | where{$_.FullFormattedMessage -like "*is powered off"} | Select @{N="VM";E={$_.vm.Name}},CreatedTime
It will look at the poweroff events for the last 7 days.
You can update the time range by updating the Start parameter and adding a Finish parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks, let me try and get back to you...
Thanks
Jithin