When executing the PowerCLI Get-VIEvent cmdlet, the number and types of properties (columns) of the retrieved event objects fluctuate depending on the event type.
Below are examples of the output behavior.
Example 1: Virtual machine CPU usage alarm status change event
Source : VMware.Vim.ManagedEntityEventArgument
Entity : VMware.Vim.ManagedEntityEventArgument
From : gray
To : green
Alarm : VMware.Vim.AlarmEventArgument
Key : 1961127
ChainId : 1961127
CreatedTime : <EVENT_CREATED_TIMESTAMP>
UserName :
Datacenter : VMware.Vim.DatacenterEventArgument
ComputeResource : VMware.Vim.ComputeResourceEventArgument
Host : VMware.Vim.HostEventArgument
Vm : VMware.Vim.VmEventArgument
Ds :
Net :
Dvs :
FullFormattedMessage : Alarm 'Virtual machine CPU usage' on ####### changed from Gray to Green
ChangeTag :
Example 2: Virtual machine guest OS shutdown task
Info : VMware.Vim.TaskInfo
Key : 1961154
ChainId : 1961154
CreatedTime : <EVENT_CREATED_TIMESTAMP>
UserName : VSPHERE.LOCAL\Administrator
Datacenter : VMware.Vim.DatacenterEventArgument
ComputeResource : VMware.Vim.ComputeResourceEventArgument
Host : VMware.Vim.HostEventArgument
Vm : VMware.Vim.VmEventArgument
Ds :
Net :
Dvs :
FullFormattedMessage : Task: Initiate guest OS shutdown
ChangeTag :
VMware vCenter Server
VMware PowerCLI
This is an architectural design of the vim.event.Event data object retrieved by Get-VIEvent.
In addition to the properties common to all events, specific properties are dynamically appended depending on the type of event that occurred.
All events maintain the following 13 common properties derived from the vim.event.Event data object.
- ChainId
- ChangeTag
- ComputeResource
- CreatedTime
- Datacenter
- Ds
- Dvs
- FullFormattedMessage
- Host
- Key
- Net
- UserName
- Vm
Upon output, the system appends specific columns per event type to these 13 properties.
In the examples described in the Issue/Introduction section, the following properties are appended :
Example 1 : Source, Entity, From, To, Alarm
Example 2 : Info
If operational requirements dictate a fixed column structure for the output, use the Select-Object cmdlet to extract only the necessary properties.
Example:
Get-VIEvent | Select-Object CreatedTime, FullFormattedMessage, Key, UserName
Related document:
Developer Portal - Get-VIEvent Command | VMware PowerCLI Reference
Developer Portal - Data Object - Event(vim.event.Event)
Exporting vCenter events using PowerCLI(328221)
vCenter Server のイベントタイプに基づく PowerCLI Get-VIEvent 出力カラムの変動