VMware Cloud Community
halr9000
Commander
Commander

Get-VIEvent comments and suggestions

This is @vmware, but posted here for others' benefit.

I've been playing with the Get-VIEvent cmdlet today. I've noticed some weird things about the objects it returns, more specifically, the VimApi objects such as in this example:

template : False

key : 11924

chainId : 11918

createdTime : 10/19/2008 4:37:47 PM

userName : Administrator

datacenter : VimApi.DatacenterEventArgument

computeResource : VimApi.ComputeResourceEventArgument

host : VimApi.HostEventArgument

vm : VimApi.VmEventArgument

fullFormattedMessage : Created virtual machine testvm on 192.168.0.55 in atl01

dynamicType :

dynamicProperty :

1. The VimApi objects are really simple with just MoRef and name fields. I think you should do a ToString() here and have that return the name of these objects rather than the type name.

2. The MoRef is contained within an object named after the base type, e.g. VimApi.DatacenterEventArgument.Datacenter. This name is...bad. It should just be called MoRef, or you should "flatten" it and rename the field to Id.

3. Either way, the MoRef isn't made in such a way that Get-View understands it:

PS > Get-View -Id $a.datacenter.datacenter

Get-View : 10/19/2008 4:43:00 PM Get-View Invalid object specified for parameter Id

- 'ManagedObjectReference'. Valid types are ManagedObjectReference and string.

At line:1 char:9

And about the cmdlet itself, I'd like to see a Category parameter added so that I could filter by event type. Yes, I know how many types there are. Smiley Happy

And lastly, I'd like to have a Key parameter to the cmdlet so that I can pull out one or more items by their key number.






Author of the upcoming book: Managing VMware Infrastructure with PowerShell

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

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