Hello
I'm using the following command to extract events from vcenter
Get-VIEvent -Start (Get-Date 03/07/2024) -Finish (Get-Date 03/08/2024) | ?{$_.FullFormattedMessage -like "*DSVM*" } | Out-GridView
But many columns shows a generic *Argument text instead of the real value.
How can I extract the corresponding value, the Datacenter compute resource and so on ?
That is because those properties are themselves objects with multiple properties.
And the PS output engine doesn't know how to display them.
You have to look at the Event object, and all it's derived objects, and then use a Select-Object with a calculated property to get the actual values you want in the output.
The Datacenter object contains a property Datacenter that itself has a MoRef, a pointer to the actual Datacenter object.
Use the Get-View cmdlet to get the actual object.
For example
Get-VIEvent -Start (Get-Date 03/07/2024) -Finish (Get-Date 03/08/2024) |
Where{$_.FullFormattedMessage -like "*DSVM*" } |
Select UserName, @{N='Datacenter';E={(Get-View -Id $_.Datacenter.Datacenter -Property Name).Name}} |
Out-GridView
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is because those properties are themselves objects with multiple properties.
And the PS output engine doesn't know how to display them.
You have to look at the Event object, and all it's derived objects, and then use a Select-Object with a calculated property to get the actual values you want in the output.
The Datacenter object contains a property Datacenter that itself has a MoRef, a pointer to the actual Datacenter object.
Use the Get-View cmdlet to get the actual object.
For example
Get-VIEvent -Start (Get-Date 03/07/2024) -Finish (Get-Date 03/08/2024) |
Where{$_.FullFormattedMessage -like "*DSVM*" } |
Select UserName, @{N='Datacenter';E={(Get-View -Id $_.Datacenter.Datacenter -Property Name).Name}} |
Out-GridView
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference