0

I am looking for a way to know when is the last time Hyper-V VM powered off.

What I would like to do is, check for the storace space used by Hyper-V VMs that has not been powered on for a long time.

I checked for other questions and found that with wmi, Win32_OperatingSystem.LastBootUpTime property I can recognize the last boot time for powered on windows os, but it is not possible to connect to powerred off VMs so this is not good. I also checked for Hyper-V wmi properties, but could not find a way to do that.

If you have any good idea, please help me!!

ululu7
  • 11
  • 1

1 Answers1

0

Fetch the Msvm_ComputerSystem object for the VM, and inspect the TimeOfLastStateChange field. Use the EnabledState field to judge whether the VM is on or off.

Donal Lafferty
  • 5,807
  • 7
  • 43
  • 60
  • Thanks for the comment. Unfortunately, TimeOfLastStateChange seems not solving this problem, as it shows last-boot-time for poweredOn vms, and something like 'Recent time' for poweredOff vms. I would like to find a way to know the "last poweredOff time" for powered off vms. Any help is appliciated. – ululu7 Jan 08 '13 at 06:45