Last powered off date for a vm in Hyper-V 2016

In Hyper-V 2012 when we had the configuration of a vm in the xml format, one could look up the last_powered_off_time node in the vm's configuration .xml file:

<last_powered_off_time type="integer">131592348393627970"</last_powered_off_time>

and get this information easy. However, in the Windows 2016 Hyper-V vm configuration format changed to a binary file .vmcx. Even though I can read the properties with Compare-VM cmdlet I cannot see a property that stores the last powered off date like I could in Hyper-V 2012 XML file.

What options do I have to check when a vm was last powered off in the Hyper-V 2016?


Solution 1:

Since the new version of configuration files on Hyper-V doesn't have such option PowerShell will not give exact information either. Try MSVM_ComputerSystem class in order to get the last state change - https://docs.microsoft.com/ru-ru/previous-versions/windows/desktop/virtual/msvm-computersystem but it will also change during the bootup.

Microsoft releasing new WMI classes each major updates and you can check the needed class here - https://docs.microsoft.com/en-us/windows/desktop/hyperv_v2/what-s-new-in-hyper-v