diff --git a/PInvoke/TaskSchd/TaskSchd.cs b/PInvoke/TaskSchd/TaskSchd.cs
index 6f231031..ef4c923e 100644
--- a/PInvoke/TaskSchd/TaskSchd.cs
+++ b/PInvoke/TaskSchd/TaskSchd.cs
@@ -19,15 +19,19 @@ namespace Vanara.PInvoke
/// This action performs a command-line operation. For example, the action can run a script, launch an executable, or, if the
/// name of a document is provided, find its associated application and launch the application with the document.
///
+ [CorrespondingType(typeof(IExecAction))]
TASK_ACTION_EXEC = 0,
/// This action fires a handler. This action can only be used if the task Compatibility property is set to TASK_COMPATIBILITY_V2.
+ [CorrespondingType(typeof(IComHandlerAction))]
TASK_ACTION_COM_HANDLER = 5,
/// This action sends email message. This action can only be used if the task Compatibility property is set to TASK_COMPATIBILITY_V2.
+ [CorrespondingType(typeof(IEmailAction))]
TASK_ACTION_SEND_EMAIL = 6,
/// This action shows a message box. This action can only be used if the task Compatibility property is set to TASK_COMPATIBILITY_V2.
+ [CorrespondingType(typeof(IShowMessageAction))]
TASK_ACTION_SHOW_MESSAGE = 7
}
@@ -289,50 +293,61 @@ namespace Vanara.PInvoke
public enum TASK_TRIGGER_TYPE2
{
/// Triggers the task when a specific event occurs. For more information about event triggers, see IEventTrigger.
+ [CorrespondingType(typeof(IEventTrigger))]
TASK_TRIGGER_EVENT = 0,
/// Triggers the task at a specific time of day. For more information about time triggers, see ITimeTrigger.
+ [CorrespondingType(typeof(ITimeTrigger))]
TASK_TRIGGER_TIME = 1,
///
/// Triggers the task on a daily schedule. For example, the task starts at a specific time every day, every other day, or every
/// third day. For more information about daily triggers, see IDailyTrigger.
///
+ [CorrespondingType(typeof(IDailyTrigger))]
TASK_TRIGGER_DAILY = 2,
///
/// Triggers the task on a weekly schedule. For example, the task starts at 8:00 AM on a specific day every week or other week.
/// For more information about weekly triggers, see IWeeklyTrigger.
///
+ [CorrespondingType(typeof(IWeeklyTrigger))]
TASK_TRIGGER_WEEKLY = 3,
///
/// Triggers the task on a monthly schedule. For example, the task starts on specific days of specific months. For more
/// information about monthly triggers, see IMonthlyTrigger.
///
+ [CorrespondingType(typeof(IMonthlyTrigger))]
TASK_TRIGGER_MONTHLY = 4,
///
/// Triggers the task on a monthly day-of-week schedule. For example, the task starts on a specific days of the week, weeks of
/// the month, and months of the year. For more information about monthly day-of-week triggers, see IMonthlyDOWTrigger.
///
+ [CorrespondingType(typeof(IMonthlyDOWTrigger))]
TASK_TRIGGER_MONTHLYDOW = 5,
/// Triggers the task when the computer goes into an idle state. For more information about idle triggers, see IIdleTrigger.
+ [CorrespondingType(typeof(IIdleTrigger))]
TASK_TRIGGER_IDLE = 6,
/// Triggers the task when the task is registered. For more information about registration triggers, see IRegistrationTrigger.
+ [CorrespondingType(typeof(IRegistrationTrigger))]
TASK_TRIGGER_REGISTRATION = 7,
/// Triggers the task when the computer boots. For more information about boot triggers, see IBootTrigger.
+ [CorrespondingType(typeof(IBootTrigger))]
TASK_TRIGGER_BOOT = 8,
/// Triggers the task when a specific user logs on. For more information about logon triggers, see ILogonTrigger.
+ [CorrespondingType(typeof(ILogonTrigger))]
TASK_TRIGGER_LOGON = 9,
///
/// Triggers the task when a specific user session state changes. For more information about session state change triggers, see ISessionStateChangeTrigger.
///
+ [CorrespondingType(typeof(ISessionStateChangeTrigger))]
TASK_TRIGGER_SESSION_STATE_CHANGE = 11,
/// Custom triggers defined by the operating system. User defined custom triggers are not supported.
@@ -1539,7 +1554,7 @@ namespace Vanara.PInvoke
/// An IRunningTaskCollection interface that contains all currently running instances of the task under the user's context.
///
[return: MarshalAs(UnmanagedType.Interface)]
- IRunningTaskCollection GetInstances(int flags);
+ IRunningTaskCollection GetInstances([Optional] int flags);
/// Gets the time the registered task was last run.
/// The time the registered task was last run.
@@ -2058,7 +2073,7 @@ namespace Vanara.PInvoke
/// This parameter is reserved for future use and must be set to 0.
/// The collection of subfolders in the folder.
[return: MarshalAs(UnmanagedType.Interface)]
- ITaskFolderCollection GetFolders(int flags);
+ ITaskFolderCollection GetFolders([Optional] int flags);
/// Creates a folder for related tasks.
///
@@ -2082,7 +2097,7 @@ namespace Vanara.PInvoke
/// specify the parent task folder in the path.
///
/// Not supported.
- void DeleteFolder([MarshalAs(UnmanagedType.BStr)] string subFolderName, [In] int flags);
+ void DeleteFolder([MarshalAs(UnmanagedType.BStr)] string subFolderName, [In, Optional] int flags);
/// Gets a task at a specified location in a folder.
///
@@ -2109,7 +2124,7 @@ namespace Vanara.PInvoke
/// task folder and the '..' characters cannot be used to specify the parent task folder in the path.
///
/// Not supported.
- void DeleteTask([In, MarshalAs(UnmanagedType.BStr)] string Name, [In] int flags);
+ void DeleteTask([In, MarshalAs(UnmanagedType.BStr)] string Name, [In, Optional] int flags);
/// Registers (creates) a new task in the folder using XML to define the task.
///
@@ -2174,7 +2189,7 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Interface)]
IRegisteredTask RegisterTaskDefinition([In, MarshalAs(UnmanagedType.BStr)] string path,
[In, MarshalAs(UnmanagedType.Interface)] ITaskDefinition pDefinition, [In] TASK_CREATION flags,
- [In, MarshalAs(UnmanagedType.Struct)] object userId, [In, MarshalAs(UnmanagedType.Struct)] object password,
+ [In, Optional, MarshalAs(UnmanagedType.Struct)] object userId, [In, Optional, MarshalAs(UnmanagedType.Struct)] object password,
[In] TASK_LOGON_TYPE logonType, [In, Optional, MarshalAs(UnmanagedType.Struct)] object sddl);
/// Gets the security descriptor for the folder.
@@ -2364,7 +2379,7 @@ namespace Vanara.PInvoke
/// The task definition that specifies all the information required to create a new task.
[return: MarshalAs(UnmanagedType.Interface)]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)]
- ITaskDefinition NewTask([In] uint flags);
+ ITaskDefinition NewTask([In, Optional] uint flags);
///
/// Connects to a remote computer and associates all subsequent calls on this interface with a remote session. If the serverName