Saturday, 15 May 2010

C++: Windows daily task schedule without user credentials -



C++: Windows daily task schedule without user credentials -

i know there bunch of illustration on msdn windows task scheduling , all(except logon/boot time) require users credentials saving task root folder , hence registering task.

// save task in root folder. iregisteredtask *pregisteredtask = null; hr = prootfolder->registertaskdefinition( _bstr_t( wsztaskname ), ptask, task_create_or_update, _variant_t(_bstr_t(pszname)), //username _variant_t(_bstr_t(pszpwd)), //password task_logon_password, _variant_t(l""), &pregisteredtask);

but have seen softwares schedule tasks on user scheme without prompting user credentials.

just want know how achieved? builting//administrator thing doesn't seem work scheduling daily tasks.

what other way out? help appreciated.

since been more 2 weeks , no reply received , answering way around solve problem.

to schedule tasks without user business relationship name , password , can take leverage of windows schtasks.exe nowadays in system32 directory.

you can create programme (which should running admin rights) execute schtasks.exe proper parameters schedule daily, weekly , monthly tasks.

for illustration : next command schedules daily task run @ time hh:mm , trigger exe every 1 hr duration of 24 hours.

schtasks.exe /create /tn "mydailytask" /tr "c:/path/to/trigger/app.exe" /f /sc daily /sd mm/dd/yyyy /st hh:mm /ri 60 /du 24:00

and can see dont need give username , password long our application running admin access.

c++ windows scheduled-tasks

No comments:

Post a Comment