So I need report of all VMs powered off more than 14 days and who powered off the VM. I can get the powered off VMs. I can get who powered them off. But when I get the list of powered of VMs and who powered them off, I'm missing the name of the VM. I'm guessing I'm missing something simple
get-vm | where {$_.powerstate -eq "PoweredOff"} |Get-VIEvent | where { $_.fullFormatted Message -like "Task: Power off*" } | select createdTime, userName, fullFotmattedMessage | where {$_.createdtime -lt (get-date).adddays(-14)}