@@ -167,6 +167,69 @@ class TriggerCollection(gdef.ITriggerCollection, TaskCollectionType):
167167 ITEM_TYPE = Trigger
168168
169169
170+ class TaskRegistrationInfo (gdef .IRegistrationInfo ):
171+ """Provides the administrative information that can be used to describe the task.
172+
173+ This information includes details such as a description of the task,
174+ the author of the task, the date the task is registered,
175+ and the security descriptor of the task.
176+ """
177+ author = generate_simple_getter ("get_Author" , gdef .BSTR )
178+ """The author of the task"""
179+ description = generate_simple_getter ("get_Description" , gdef .BSTR )
180+ """The description of the task"""
181+ date = generate_simple_getter ("get_Date" , gdef .BSTR )
182+ """The registration date of the task"""
183+ source = generate_simple_getter ("get_Source" , gdef .BSTR )
184+ """Where the task originated from.
185+
186+ For example, a task may originate from a component, service, application, or user.
187+ """
188+ documentation = generate_simple_getter ("get_Documentation" , gdef .BSTR )
189+ """Any additional documentation for the task"""
190+ uri = generate_simple_getter ("get_URI" , gdef .BSTR )
191+ """the URI of the task."""
192+ version = generate_simple_getter ("get_Version" , gdef .BSTR )
193+ """The version number of the task."""
194+
195+ # Return WindowsError: [Error -2147467263] Not implemented
196+ # xml = generate_simple_getter("get_XmlText", gdef.BSTR)
197+
198+ sddl = generate_simple_getter ("get_SecurityDescriptor" , windows .com .Variant )
199+
200+ @property
201+ def security_descriptor (self ):
202+ sddl = self .sddl
203+ if not sddl :
204+ return None
205+ return windows .security .SecurityDescriptor .from_string (sddl )
206+
207+
208+
209+ class TaskPrincipal (gdef .IPrincipal ):
210+ """Provides the security credentials for a principal.
211+ These security credentials define the security context for the tasks that are associated with the principal.
212+ """
213+
214+ name = generate_simple_getter ("get_DisplayName" , gdef .BSTR )
215+ """The name of the principal"""
216+ id = generate_simple_getter ("get_Id" , gdef .BSTR )
217+ """the identifier of the principal."""
218+ user_id = generate_simple_getter ("get_UserId" , gdef .BSTR )
219+ """the user identifier that is required to run the task"""
220+ group_id = generate_simple_getter ("get_GroupId" , gdef .BSTR )
221+ """the user group that is required to run the task"""
222+ run_level = generate_simple_getter ("get_RunLevel" , gdef .TASK_RUNLEVEL_TYPE )
223+ """the privilege level that is required to run the tasks
224+
225+ :type: :class:`~windows.generated_def.winstructs.TASK_RUNLEVEL_TYPE`
226+ """
227+ logon_type = generate_simple_getter ("get_LogonType" , gdef .TASK_LOGON_TYPE )
228+ """ logon method that is required to run the task
229+
230+ :type: :class:`~windows.generated_def.winstructs.TASK_LOGON_TYPE`
231+ """
232+
170233class TaskDefinition (gdef .ITaskDefinition ):
171234 """The definition of a task"""
172235 actions = generate_simple_getter ("get_Actions" , ActionCollection , extract_value = False )
@@ -180,6 +243,27 @@ class TaskDefinition(gdef.ITaskDefinition):
180243 :type: :class:`TriggerCollection`
181244 """
182245
246+ registration_info = generate_simple_getter ("get_RegistrationInfo" , TaskRegistrationInfo , extract_value = False )
247+ """The registration information of the task
248+
249+ :type: :class:`TaskRegistrationInfo`
250+ """
251+
252+ principal = generate_simple_getter ("get_Principal" , TaskPrincipal , extract_value = False )
253+ """The principal that provides the security credentials for the task.
254+ These security credentials define the security context for the tasks that are associated with the principal.
255+
256+ :type: :class:`TaskPrincipal`
257+ """
258+
259+ xml = generate_simple_getter ("get_XmlText" , gdef .BSTR )
260+ """The XML representig the task definition
261+
262+ :type: :class:`str`
263+ """
264+
265+
266+
183267class Task (gdef .IRegisteredTask ):
184268 """A scheduled task"""
185269 name = generate_simple_getter ("get_Name" , gdef .BSTR )
@@ -189,14 +273,28 @@ class Task(gdef.IRegisteredTask):
189273 state = generate_simple_getter ("get_State" , gdef .TASK_STATE )
190274 """The state of the task
191275
276+
192277 :type: :class:`~windows.generated_def.winstructs.TASK_STATE`
193278 """
279+ enabled = generate_simple_getter ("get_Enabled" , gdef .VARIANT_BOOL )
280+ """``True`` is the task is enabled"""
281+ last_runtime = generate_simple_getter ("get_LastRunTime" , gdef .DATE )
282+ """Gets the last time the registered task was last run."""
283+ next_runtime = generate_simple_getter ("get_NextRunTime" , gdef .DATE )
284+ """Gets the next time the registered task will be run."""
285+
194286 definition = generate_simple_getter ("get_Definition" , TaskDefinition , extract_value = False )
195287 """The definition of the task
196288
197289 :type: :class:`TaskDefinition`
198290 """
199291
292+ xml = generate_simple_getter ("get_Xml" , gdef .BSTR )
293+ """The XML representig the task
294+
295+ :type: :class:`str`
296+ """
297+
200298 def run (self , params = None , flags = gdef .TASK_RUN_NO_FLAGS , sessionid = 0 , user = None ):
201299 if params is None : params = gdef .VARIANT () # Empty variant
202300 result = gdef .IRunningTask ()
0 commit comments