VMware Cloud Community
06dragon
Contributor
Contributor

PowerCLI cmdlet to count the shutdown duration

Hi,

is there any cmdlet/any other way, so that I can count the number of days since when a VM is shutdown, via powerCLI.

e.g. to get a list of all the VMs which are powered-off since more than 30 days.


Thanks for any help!!

Regards

Ashish

0 Kudos
1 Reply
LucD
Leadership
Leadership

There is no cmdlet for that, but you can use the Tasks and Events that are kept on vCenter.

To access those you use the Get-VIEvent cmdlet.

You can also have a look at my Get-VIEventPlus function in my Get the vMotion/svMotion history post.

In my HA VM failover tracking post I explain how to find the available eventtypes.

In this case you will want to fetch the VmPoweredOffEvent event


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos