Automation

 View Only
  • 1.  Unable to get event details

    Posted May 20, 2020 05:22 PM

    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



  • 2.  RE: Unable to get event details
    Best Answer

    Posted May 20, 2020 05:31 PM

    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



  • 3.  RE: Unable to get event details

    Posted May 20, 2020 05:47 PM

    Thank you LucD, that worked. :smileyhappy:

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



  • 4.  RE: Unable to get event details

    Posted May 20, 2020 05:53 PM

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

    Even my Get-VIEventPlus function became much slower.