VMware Cloud Community
RobAncheril1
Contributor
Contributor

PowerCLI Script – Report Powered off VM’s and date

Greetings,

Can someone help me with script to generate a report using PowerCLI for powered off VM's and date the VM was powered off?

Thanks,

Rob

0 Kudos
3 Replies
kwhornlcs
Enthusiast
Enthusiast

You need to parse the Events to get this information.

I run the script linked below as a scheduled task. It looks for events occurring within a 1 day period to add notes on VMs that have been powered off - but could probably give you enough to go on to export information to a CSV or other format.

powercli/VM-ShutdownNotes.ps1 at master · kdmhorn/powercli · GitHub

You can also look here Script for Shutdown VMs Details for other information.

Just remember that by default events are only held for 30 days, so if the shutdowns occurred before that, you may not be able to capture the information.

0 Kudos
Srinivas_k
Enthusiast
Enthusiast

Hi,

I am looking for same information, can we get who powered-off them and can we get this data from Vcenter database why because the list of power of Vms i am looking in there is no events in vcenter.

0 Kudos
kwhornlcs
Enthusiast
Enthusiast

Cannot get the information from vCenter database, unfortunately this is events only. This is why I run the script I listed daily - adds the information to the notes of the VM so it doesn't get lost in the retention period.

0 Kudos