VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Unable to get event details

Hi,

I am unable to get VM created, deleted, Cloned and beingdeployed details from below

Get-VIEvent -Start (Get-Date).AddDays(-30) -MaxSamples ([int]::MaxValue) | where{$_ -is [VMware.Vim.VmCreatedEvent] -and $_ -is [VMware.Vim.VmBeingClonedEvent] -and $_ -is [VMware.Vim.VmBeingDeployedEvent] -and $_ -is [VMware.Vim.VmRemovedEvent]} | Sort CreatedTime -Descending | Select CreatedTime, UserName, @{N='VM';E={$_.VM.Name}}, FullformattedMessage | ft -auto

I am seeing blank output

Please help

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

In your Where-clause, you are stating that each event should be all those types.

You should change the -and in -or in the Where-clause


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

In your Where-clause, you are stating that each event should be all those types.

You should change the -and in -or in the Where-clause


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Thank you LucD, that worked. Smiley Happy

One quick question, it takes long time to get the output, is there a way to speed up the output ?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Unfortunately not.
The retrieval speed for events has dramatically decreased since vSphere 6.

Even my Get-VIEventPlus function became much slower.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos