This is a followup to this question I posted but running into an issue with enumerating events on some objects now. When I run the following code (or try any of the solutions in my prior question) to get the events from a datastore or datastore cluster for example:
Get-VMFolder FOLDER_NAME -Type Datastore | Get-DatastoreCluster | Get-VIEvent
I'm met with the following error for each event it tries to return:
Events can be retrieved only for inventory objects. The entity of type
'VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl' will be ignored.
This is particularly annoying since the cmdlet clearly enumerates the events as I get this error for every event it attempts to return.
When I use the Get-TaskPlus
function mentioned in the accepted answer to my prior question returns a different type conversion error:
Cannot process argument transformation on parameter 'Entity'. Cannot convert the "DATASTORE_CLUSTER_NAME" value of type "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.DatastoreClusterImpl" to type "VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl".
If I remove the type constraint on the $Entity
argument in the function definition, the error goes away but I also don't get any results.
I'm not really looking for recommendations or tools here, but if Get-VIEvent
to look for events on non-inventory objects through PowerCLI, is there a workaround or more nuanced way to retrieve this information with PowerCLI?