fborges555
Enthusiast
Enthusiast

List snapshots older than and only powered on VM

Hi gurus 

I want a list of all powered ON vm with snapshot older than 5 days, I have the following but as you can tell still curving some learning

$PowONvm = Get-VM |where {$_.powerstate -eq "PoweredOn"}| Get-Snapshot | Where {$_.Created -lt (Get-Date).AddDays(-5)} |select vm,name,powerstate

This bring powered off and on vm , can someone help on where I went wrong.

 

Thanks

Reply
0 Kudos