I have VM name and want to find who deleted the VM. Tried below but there is no output.
Get-VIEvent -maxsamples ([int]::MaxValue) -Start (Get-Date).AddDays(–14) |
where{$_ -is [VMware.Vim.VmRemovedEvent] -and $_.VM -ne 'VMNAME'} |
Sort -Property CreatedTime -Descending|
Select CreatedTime,UserName,FullformattedMessage
I am not sure we can use "-and $_.VM -ne 'VMNAME'} |" This parameters.