TaskScheduler WMI API - is it possible to modify task?

Dawid W 21 Reputation points


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);
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,279 questions
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,313 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 79,746 Reputation points

    See MSDN samples using ITaskScheduler interface, like Setting Task Property Examples

0 additional answers

Sort by: Most helpful