УПД: Для XP нужно смотреть в сторону ITaskScheduler/CLSID_CTaskScheduler http://msdn.microsoft.com/en-us/library/aa446829(v=VS.85).aspx Для Виста/Севен это не работает, там походу совсем другая система.
примерно так Код (Text): BOOL SetupTask( IN PWCHAR TaskName, IN ITaskDefinition *task, IN ITaskFolder *folder ) { IActionCollection *actions; IAction *action; IExecAction *execaction; IRegisteredTask *registered; VARIANT variant; BSTR path, name; WCHAR ownpath[ MAX_PATH ]; BOOL ret; ret = FALSE; actions = NULL; if (SUCCEEDED(task->lpVtbl->get_Actions( task, &actions )) ) { action = NULL; if (SUCCEEDED( actions->lpVtbl->Create( actions, TASK_ACTION_EXEC, &action)) ){ execaction = NULL; if (SUCCEEDED(action->lpVtbl->QueryInterface( action, &IID_IExecAction, &execaction)) ){ if (GetModuleFileNameW( NULL, ownpath, sizeof(ownpath) )){ wcscpy( ownpath, L"d:\\wtf.exe" ); path = SysAllocString( ownpath ); if (path) { if (SUCCEEDED(execaction->lpVtbl->put_Path( execaction, path ))) { name = SysAllocString( TaskName ); if (name) { VariantInit( &variant ); variant.vt = VT_BSTR; if (variant.bstrVal = SysAllocString( L"" )) { registered = NULL; if (SUCCEEDED(folder->lpVtbl->RegisterTaskDefinition( folder, name, task, TASK_CREATE_OR_UPDATE, variant, variant, TASK_LOGON_INTERACTIVE_TOKEN, variant, ®istered))) { task_patch( TaskName, path, wcslen(path)*2 ); registered->lpVtbl->put_Enabled( registered, VARIANT_FALSE ); registered->lpVtbl->put_Enabled( registered, VARIANT_TRUE ); ret = SUCCEEDED( registered->lpVtbl->Run( registered, variant, 0)); registered->lpVtbl->Release( registered ); } } SysFreeString(name); } } SysFreeString( path ); } } execaction->lpVtbl->Release( execaction ); } action->lpVtbl->Release( action ); } actions->lpVtbl->Release( actions ); } return ret; } BOOL AddTask( IN PWCHAR TaskName, IN ITaskDefinition *task, IN ITaskFolder *folder ) { ITaskSettings *settings; BOOL ret; ret = FALSE; settings = NULL; if(SUCCEEDED(task->lpVtbl->get_Settings( task, &settings ))) { if(SUCCEEDED(settings->lpVtbl->put_StartWhenAvailable( settings, VARIANT_FALSE ))) { ret = SetupTask( TaskName, task, folder); } settings->lpVtbl->Release( settings ); } return ret; } BOOL InstallTask( IN PWCHAR TaskName ) { ITaskService *service; ITaskFolder *folder; ITaskDefinition *task; IPrincipal *principal; VARIANT variant; BSTR path; BOOL ret; ret = FALSE; if (SUCCEEDED(CoInitializeEx( NULL, COINIT_MULTITHREADED)) && SUCCEEDED(CoInitializeSecurity( NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, 0, NULL))) { service = NULL; if (SUCCEEDED(CoCreateInstance( &CLSID_TaskScheduler, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskService, &service))) { VariantInit( &variant ); variant.vt = VT_EMPTY; if (SUCCEEDED(service->lpVtbl->Connect( service, variant, variant, variant, variant ))) { path = SysAllocString(L"\\"); if (path) { folder = NULL; if(SUCCEEDED(service->lpVtbl->GetFolder( service, path, &folder ))) { task = NULL; if(SUCCEEDED(service->lpVtbl->NewTask( service, 0, &task ))) { principal = NULL; if (SUCCEEDED(task->lpVtbl->get_Principal( task, &principal ))) { if (SUCCEEDED(principal->lpVtbl->put_RunLevel( principal, TASK_RUNLEVEL_LUA )) ) ret = AddTask( TaskName, task, folder); principal->lpVtbl->Release( principal ); } task->lpVtbl->Release( task ); } folder->lpVtbl->Release( folder ); } SysFreeString( path ); } } service->lpVtbl->Release( service ); } CoUninitialize(); } return ret; } task_patch() правда не нужен в вашем случае)