A little word Today to say How can we get all events for vMotion, create, deployed or registrer a virtual machine as well as Who did it. We can search event with “Get-VIEvent”, and filter them this “-Type”, “-Start” or “-Finish”. For more information, please look at “Get-Help” for this command. You can follow SDK on VMWare to help you if you need to search another thing.
Example :
How can I get back virtual machines created, registered or deployed
Get-VM | Get-VIEvent | Where {$_ -is [Vmware.vim.VmBeingDeployedEvent] -or $_ -is [Vmware.vim.VmCreatedEvent] -or $_ -is [Vmware.vim.VmRegisteredEvent]} | Select UserName, CreatedTime, FullFormattedMessage, @{Name="VM"; Expression={$_.Vm.Name}}, @{ Name="CPU"; Expression={(Get-VM -Name $_.Vm.Name).NumCPU}}
How can I get back virtual machines Migrated
Get-VM | Get-VIEvent | Where {$_ -is [Vmware.vim.VmMigratedEvent] -or $_ -is [Vmware.vim.VmRelocatedEvent] -or $_ -is [Vmware.vim.VmRelocateFailedEvent] -or $_ -is [Vmware.vim.VmRelocateSpecEvent] -or $_ -is [Vmware.vim.VmBeingHotMigratedEvent] -or $_ -is [Vmware.vim.VmBeingMigratedEvent] -or $_ -is [Vmware.vim.VmBeingRelocatedEvent]} | Select UserName, CreatedTime, FullFormattedMessage, @{Name="VM"; Expression={$_.Vm.Name}}, @{ Name="CPU"; Expression={(Get-VM -Name $_.Vm.Name).NumCPU}}