Skip to content

Commit 5965697

Browse files
authored
ScheduledTask: Update documentation with more parameter requirements (#439)
1 parent 7b0317d commit 5965697

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
- Updated RandomDelay logic from a blacklist to a whitelist.
3333
- Updated Delay parameter logic to reflect other TimeSpan based values.
3434
- Updated unit tests to use Should -Invoke for Pester 5 compatibility.
35+
- Updated various parameters with requirements in documentation.
3536
- `VirtualMemory` fix incorrect variable name
3637
- `SmbServerConfiguration` remove errant argument
3738
- Update all calls to edit the registry so that the value Type is explicitly set.

source/DSCResources/DSC_ScheduledTask/DSC_ScheduledTask.psm1

+12-6
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ function Get-TargetResource
124124
125125
.PARAMETER DaysInterval
126126
Specifies the interval between the days in the schedule. An interval of 1 produces
127-
a daily schedule. An interval of 2 produces an every-other day schedule.
127+
a daily schedule. An interval of 2 produces an every-other day schedule. This
128+
parameter is only valid in combination with the Daily Schedule Type.
128129
129130
.PARAMETER RandomDelay
130131
Specifies a random amount of time to delay the start time of the trigger. The
@@ -143,11 +144,13 @@ function Get-TargetResource
143144
Specifies the amount of time for the trigger that Task Scheduler is allowed to complete the task.
144145
145146
.PARAMETER DaysOfWeek
146-
Specifies an array of the days of the week on which Task Scheduler runs the task.
147+
Specifies an array of the days of the week on which Task Scheduler runs the task. This
148+
parameter is only valid in combination with the Weekly Schedule Type.
147149
148150
.PARAMETER WeeksInterval
149151
Specifies the interval between the weeks in the schedule. An interval of 1 produces
150-
a weekly schedule. An interval of 2 produces an every-other week schedule.
152+
a weekly schedule. An interval of 2 produces an every-other week schedule. This
153+
parameter is only valid in combination with the Weekly Schedule Type.
151154
152155
.PARAMETER User
153156
Specifies the identifier of a user that will trigger the task to start. This
@@ -1130,7 +1133,8 @@ function Set-TargetResource
11301133
11311134
.PARAMETER DaysInterval
11321135
Specifies the interval between the days in the schedule. An interval of 1 produces
1133-
a daily schedule. An interval of 2 produces an every-other day schedule.
1136+
a daily schedule. An interval of 2 produces an every-other day schedule. This
1137+
parameter is only valid in combination with the Daily Schedule Type.
11341138
11351139
.PARAMETER RandomDelay
11361140
Specifies a random amount of time to delay the start time of the trigger. The
@@ -1149,11 +1153,13 @@ function Set-TargetResource
11491153
Specifies the amount of time for the trigger that Task Scheduler is allowed to complete the task.
11501154
11511155
.PARAMETER DaysOfWeek
1152-
Specifies an array of the days of the week on which Task Scheduler runs the task.
1156+
Specifies an array of the days of the week on which Task Scheduler runs the task. This
1157+
parameter is only valid in combination with the Weekly Schedule Type.
11531158
11541159
.PARAMETER WeeksInterval
11551160
Specifies the interval between the weeks in the schedule. An interval of 1 produces
1156-
a weekly schedule. An interval of 2 produces an every-other week schedule.
1161+
a weekly schedule. An interval of 2 produces an every-other week schedule. This
1162+
parameter is only valid in combination with the Weekly Schedule Type.
11571163
11581164
.PARAMETER User
11591165
Specifies the identifier of a user that will trigger the task to start. This

source/DSCResources/DSC_ScheduledTask/DSC_ScheduledTask.schema.mof

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ class DSC_ScheduledTask : OMI_BaseResource
1616
[Write, Description("Run the task as one of the built in service accounts. When set ExecuteAsCredential will be ignored and LogonType will be set to 'ServiceAccount'."), ValueMap{"SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE"}, Values{"SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE"}] string BuiltInAccount;
1717
[Write, Description("The credential this task should execute as. If not specified defaults to running as the local system account."), EmbeddedInstance("MSFT_Credential")] string ExecuteAsCredential;
1818
[Write, Description("The gMSA (Group Managed Service Account) this task should execute as. Cannot be used in combination with ExecuteAsCredential or BuiltInAccount.")] string ExecuteAsGMSA;
19-
[Write, Description("Specifies the interval between the days in the schedule. An interval of 1 produces a daily schedule. An interval of 2 produces an every-other day schedule.")] Uint32 DaysInterval;
19+
[Write, Description("Specifies the interval between the days in the schedule. An interval of 1 produces a daily schedule. An interval of 2 produces an every-other day schedule. Can only be used in combination with ScheduleType Daily.")] Uint32 DaysInterval;
2020
[Write, Description("Specifies a random amount of time to delay the start time of the trigger. The delay time is a random time between the time the task triggers and the time that you specify in this setting. Can only be used in combination with ScheduleType Once, Daily and Weekly.")] String RandomDelay;
2121
[Write, Description("Specifies how long the repetition pattern repeats after the task starts. May be set to `Indefinitely` to specify an indefinite duration.")] String RepetitionDuration;
2222
[Write, Description("Indicates that Task Scheduler stops all running tasks at the end of the repetition duration. Defaults to $false.")] Boolean StopAtDurationEnd;
2323
[Write, Description("Specifies the amount of time for the trigger that Task Scheduler is allowed to complete the task.")] String TriggerExecutionTimeLimit;
24-
[Write, Description("Specifies an array of the days of the week on which Task Scheduler runs the task.")] String DaysOfWeek[];
25-
[Write, Description("Specifies the interval between the weeks in the schedule. An interval of 1 produces a weekly schedule. An interval of 2 produces an every-other week schedule.")] Uint32 WeeksInterval;
24+
[Write, Description("Specifies an array of the days of the week on which Task Scheduler runs the task. Can only be used in combination with ScheduleType Weekly.")] String DaysOfWeek[];
25+
[Write, Description("Specifies the interval between the weeks in the schedule. An interval of 1 produces a weekly schedule. An interval of 2 produces an every-other week schedule. Can only be used in combination with ScheduleType Weekly.")] Uint32 WeeksInterval;
2626
[Write, Description("Specifies the identifier of a user that will trigger the task to start. Can only be used in combination with ScheduleType AtLogon and OnSessionState.")] String User;
2727
[Write, Description("Indicates whether the task is prohibited to run on demand or not. Defaults to $false.")] Boolean DisallowDemandStart;
2828
[Write, Description("Indicates whether the task is prohibited to be terminated or not. Defaults to $false.")] Boolean DisallowHardTerminate;
@@ -48,7 +48,7 @@ class DSC_ScheduledTask : OMI_BaseResource
4848
[Write, Description("Specifies the level of user rights that Task Scheduler uses to run the tasks that are associated with the principal. Defaults to 'Limited'."), ValueMap{"Limited","Highest"}, Values{"Limited","Highest"}] String RunLevel;
4949
[Write, Description("Specifies the security logon method that Task Scheduler uses to run the tasks that are associated with the principal."), ValueMap{"Group","Interactive","InteractiveOrPassword","None","Password","S4U","ServiceAccount"}, Values{"Group","Interactive","InteractiveOrPassword","None","Password","S4U","ServiceAccount"}] String LogonType;
5050
[Write, Description("Specifies the EventSubscription in XML. This can be easily generated using the Windows Eventlog Viewer. For the query schema please check: https://docs.microsoft.com/en-us/windows/desktop/WES/queryschema-schema. Can only be used in combination with ScheduleType OnEvent.")] String EventSubscription;
51-
[Write, Description("Specifies the EventValueQueries. Receives a hashtable where the key is a property value for an event and the value is an XPath event query. For more detailed syntax check: https://learn.microsoft.com/en-us/windows/win32/taskschd/eventtrigger-valuequeries."), EmbeddedInstance("MSFT_KeyValuePair")] String EventValueQueries[];
51+
[Write, Description("Specifies the EventValueQueries. Receives a hashtable where the key is a property value for an event and the value is an XPath event query. For more detailed syntax check: https://learn.microsoft.com/en-us/windows/win32/taskschd/eventtrigger-valuequeries. Can only be used in combination with ScheduleType OnEvent."), EmbeddedInstance("MSFT_KeyValuePair")] String EventValueQueries[];
5252
[Write, Description("Specifies a delay to the start of the trigger. The delay is a static delay before the task is executed. Can only be used in combination with ScheduleType AtLogon, AtStartup, OnEvent, AtCreation and OnSessionState.")] String Delay;
5353
[Write, Description("Specifies the kind of session state change that would trigger a task launch. Can only be used in combination with ScheduleType OnSessionState."), ValueMap{"OnConnectionFromLocalComputer", "OnDisconnectFromLocalComputer", "OnConnectionFromRemoteComputer", "OnDisconnectFromRemoteComputer", "OnWorkstationLock", "OnWorkstationUnlock"}, Values{"OnConnectionFromLocalComputer", "OnDisconnectFromLocalComputer", "OnConnectionFromRemoteComputer", "OnDisconnectFromRemoteComputer", "OnWorkstationLock", "OnWorkstationUnlock"}] string StateChange;
5454
};

0 commit comments

Comments
 (0)