Sure, try like this.
Note1: this might run a while, since it will fetch quite a few events
Note2: you can adapt the value in $vmName to pick a specific set of VMs
Note3: the sample script that was pointed to in the other answer only goes back 1 day
$vmName = '*'$eventTYpes = 'VmCreatedEvent', 'VmClonedEvent', 'VmDeployedEvent', 'VmRegisteredEvent'
Get-VM -Name $vmName |
ForEach-Object -Process {
Get-VIEvent -Entity $_ -MaxSamples ([int]::MaxValue) |
where { $eventTYpes -contains $_.GetType().Name } |
Sort-Object -Property CreatedTime -Descending |
Select -First 1 |
ForEach-Object -Process {
New-Object PSObject -Property ([ordered]@{
VM = $_.VM.Name
CreatedTime = $_.CreatedTime
User = $_.UserName
EventType = $_.GetType().Name
})
}
}