Gurus
I have the following
$vmoff = get-vm |Where-object {$_.powerstate -eq "poweredoff"}
but how do I go and get the date when they were turn off
By retrieving the VMPoweredOffEvent objects from the Event history with Get-VIEvent.Provided your environment is configured to keep Events sufficiently long enough.There are numerous examples in this community on that subject.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference