See MSDN samples using ITaskScheduler interface, like Setting Task Property Examples
TaskScheduler WMI API - is it possible to modify task?
Dawid W
21
Reputation points
Hi,
I'm trying to modify scheduled task through WMI Microsoft\Windows\MSFT_ScheduledTask object. However when I call instance Put method to update it I'm getting "Not supported" error. Nothing works. Is it possible at all? Am I doing something wrong?
Below is the code snippet I use for instance update after modification of its one property. Result returned is WBEM_E_NOT_SUPPORTED (0x8004100c).
void WmiObject::Commit()
{
IWbemCallResultPtr resultObj;
// IWbemServices* WmiComConnection::ServiceObject()
// IWbemClassObjectPtr comPtr;
HRESULT result = comConnection->ServiceObject()->PutInstance(comPtr, WBEM_FLAG_UPDATE_ONLY, NULL, NULL);
if (FAILED(result))
{
throw WmiException("Failed to update a WMI object", result);
}
}