maaca
Enthusiast
Enthusiast

PropertyCollector.RetrievePropertiesEx instead of VcVirtualMachine.recentTask

Jump to solution

I would like to get results of VcVirtualMachine.recentTask, but according the documentation it is not working anymore:

In releases after vSphere API 5.0, vSphere Servers might not generate property collector update notifications for this property. To obtain the latest value of the property, you can use PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx.


I haven't found any example using it and the documentation didn't really helped me to understand how to use it.

Could somebody point me to the right direction?

maaca

0 Kudos
1 Solution

Accepted Solutions
dvatov
VMware Employee
VMware Employee
0 Kudos
6 Replies
dvatov
VMware Employee
VMware Employee

Here you can find example Reading configured memory of resourcepool

maaca
Enthusiast
Enthusiast

Thank you for pointing on that.

Sadly, result of this query is empty:

entityType = 'VirtualMachine';

propertyPaths = ['recentTask'];

entityIds = ['vm-XXXXX']

[2015-07-10 11:04:25.534] [I] vm-XXXXX

[2015-07-10 11:04:25.535] [I] VirtualMachine

[2015-07-10 11:04:25.536] [I] recentTask

[2015-07-10 11:04:25.536] [I]

Am I using correct propertyPaths? It exist, but contains nothing. Is there some "property collector inventory browser"?

0 Kudos
dvatov
VMware Employee
VMware Employee

tasks are available only couple of minutes through this property after they complete. Can you create a task and right after that try to fetch it with the script

0 Kudos
maaca
Enthusiast
Enthusiast

Ah I see.

Is there some way to get also older tasks?

0 Kudos
dvatov
VMware Employee
VMware Employee

This should work for you - Using a TaskHistoryCollector

0 Kudos
maaca
Enthusiast
Enthusiast

Thank you. This is exactly what I need.

0 Kudos