1+ <#
2+ This example creates five tasks with the following schedules that start a new powershell process
3+ - Once at 00:00 repeating every 15 minutes for 8 hours
4+ - Daily at 00:00 repeating every 15 minutes for 8 hours
5+ - Weekly at 00:00 repeating every 15 minutes for 8 hours on Mon, Wed, Sat
6+ - At logon repeating every 15 minutes for 8 hours
7+ - At startup repeating every 15 minutes for 8 hours
8+ #>
19Configuration Sample_xScheduledTask
210{
311 Import-DscResource - ModuleName xComputerManagement
4- node " localhost"
12+ node ' localhost'
513 {
614 xScheduledTask xScheduledTaskOnceAdd
715 {
8- TaskName = " Test task once"
9- TaskPath = " \MyTasks"
10- ActionExecutable = " C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
16+ TaskName = ' Test task once'
17+ TaskPath = ' \MyTasks'
18+ ActionExecutable = ' C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe'
1119 ScheduleType = ' Once'
1220 RepeatInterval = [datetime ]::Today.AddMinutes(15 )
1321 RepetitionDuration = [datetime ]::Today.AddHours(8 )
@@ -21,9 +29,9 @@ Configuration Sample_xScheduledTask
2129
2230 xScheduledTask xScheduledTaskDailyAdd
2331 {
24- TaskName = " Test task Daily"
25- TaskPath = " \MyTasks"
26- ActionExecutable = " C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
32+ TaskName = ' Test task Daily'
33+ TaskPath = ' \MyTasks'
34+ ActionExecutable = ' C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe'
2735 ScheduleType = ' Daily'
2836 DaysInterval = 1
2937 RepeatInterval = [datetime ]::Today.AddMinutes(15 )
@@ -36,9 +44,9 @@ Configuration Sample_xScheduledTask
3644
3745 xScheduledTask xScheduledTaskWeeklyAdd
3846 {
39- TaskName = " Test task Weekly"
40- TaskPath = " \MyTasks"
41- ActionExecutable = " C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
47+ TaskName = ' Test task Weekly'
48+ TaskPath = ' \MyTasks'
49+ ActionExecutable = ' C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe'
4250 ScheduleType = ' Weekly'
4351 WeeksInterval = 1
4452 DaysOfWeek = ' Monday' , ' Wednesday' , ' Saturday'
@@ -51,19 +59,19 @@ Configuration Sample_xScheduledTask
5159
5260 xScheduledTask xScheduledTaskLogonAdd
5361 {
54- TaskName = " Test task Logon"
55- TaskPath = " \MyTasks"
56- ActionExecutable = " C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
62+ TaskName = ' Test task Logon'
63+ TaskPath = ' \MyTasks'
64+ ActionExecutable = ' C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe'
5765 ScheduleType = ' AtLogOn'
5866 RepeatInterval = [datetime ]::Today.AddMinutes(15 )
5967 RepetitionDuration = [datetime ]::Today.AddHours(8 )
6068 }
6169
6270 xScheduledTask xScheduledTaskStartupAdd
6371 {
64- TaskName = " Test task Startup"
65- TaskPath = " \MyTasks"
66- ActionExecutable = " C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
72+ TaskName = ' Test task Startup'
73+ TaskPath = ' \MyTasks'
74+ ActionExecutable = ' C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe'
6775 ScheduleType = ' AtStartup'
6876 RepeatInterval = [datetime ]::Today.AddMinutes(15 )
6977 RepetitionDuration = [datetime ]::Today.AddHours(8 )
0 commit comments