I'm trying to create subfolder in the TaskScheduler (using Delphi) and create schedules for my application inside the subfolder.
For TaskScheduler-access I use this EE-example
To create a subfolder I found method TaskFolder.CreateFolder('\MyFolder', ?sddl?);
Here sddl (=security descriptor associated with the folder) must be set, but I have no idea how to set it correctly.
So as a workaround I tried to create the folder "MyFolder" directly into folder "C:\Windows\System32\tasks
The folder is actually created by my application, but the folder is not visible inside Windows TaskScheduler.
procedure TForm1.Button1Click(Sender: TObject);
var ts : TTaskScheduler;
CoInitialize(nil); // uses ActiveX
ts := TTaskScheduler.Create(Self);
ts.AutoConnect := True;
if ts.Connected then
// ts.GetFolder('\MyFolder', ?sddl? ); << THIS DOESN'T WORK
// As a workaround I create the folder myself.
// System32 is changed into SysNative, as otherwise the folder would be created in SysWOW64.
if DirectoryExists('C:\Windows\SysNative\tasks\MyFolder\') then
tf := ts.GetFolder('\MyFolder') // << THIS GIVES AN UNKNOWN ERROR
tf := ts.GetFolder('\');
How can I create a subfolder for taskscheduler in order to add my application's schedules inside that subfolder?