Luc
How can I take your script:
$vms = Get-VM | where {$_.PowerState -eq "PoweredOff"} $vmPoweredOff = $vms | %{$_.Name} $events = Get-VIEvent -Start (Get-Date).AddDays(-31) -Entity $vms -MaxSamples ([int]::MaxValue) | where{$_.FullFormattedMessage -like "*is powered off"} $lastweekVM = $events | %{$_.Vm.Name} $vmPoweredOff | where {!($lastweekVM -contains $_)}
...and find out when was the last time the vm that have been powered down for 30 days powered on?
Maybe make your script into a function and the code that get's the powred on date into a function as well then pass the vm names to the function?