VMware Cloud Community
robmatrovemobil
Contributor
Contributor

How to use Get-VIEvent in a recursive fashion to get events on child entities?

When I use Get-VIEvent for entities like a datacenter, I only get events that happened on the datacenter itself, not events that happened on child entities of the datacenter. When I use the VI client and view events on a datacenter, I get the events that happened on the datacenter (I assume/hope) and events that happened on the child entities.

I am hoping/wondering if there is some way in one call to Get-VIEvent -Entity someDataCenter that I can get events for child entities using the vi toolkit. Getting all the children of the datacenter then calling get-vievent on each child will not be fast enough for my purposes.

Rob.

Reply
0 Kudos
3 Replies
halr9000
Commander
Commander

Have you tried Get-VIEvent by itself w/o specifying an entity? Is that what you want? You could also try specifying multiple objects to the Entity param as it will take arrays and also works on the pipeline. Oh, I just thought of something that might work.

Get-Datacenter foo | Get-Inventory | Get-VIEvent






[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
robmatrovemobil
Contributor
Contributor

That will certainly get the information that I am after, it will need a sort but all the info is there.

But, with one esx server in the datacenter and 18 vms on the esx server and collecting only 15 maxSamples, it takes over 20 seconds for this collection of commands to execute.

I'm looking for something faster...

Rob.

Reply
0 Kudos
halr9000
Commander
Commander

In that case, you'll have to use the EventManager object. LucD has an example here:

PowerShell MVP, VI Toolkit forum moderator

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos