Examples/Resources/ScheduledTask/2-ScheduledTask_CreateScheduledTaskDaily_Config.ps1
<#PSScriptInfo .VERSION 1.0.0 .GUID ce544d27-c44f-44d9-a771-1ae9b22b180c .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation .COPYRIGHT (c) Microsoft Corporation. All rights reserved. .TAGS DSCConfiguration .LICENSEURI https://github.com/PowerShell/ComputerManagementDsc/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/ComputerManagementDsc .ICONURI .EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version. .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core #> #Requires -module ComputerManagementDsc <# .DESCRIPTION This example creates a scheduled task called 'Test task Daily' in the folder task folder 'MyTasks' that starts a new powershell process every day at 00:00 repeating every 15 minutes for 8 hours. If the task fails it will be restarted after 5 minutes and it will be restarted a maximum of two times. It will only run if the network is connected and will wake the machine up to execute the task. #> Configuration ScheduledTask_CreateScheduledTaskDaily_Config { Import-DscResource -ModuleName ComputerManagementDsc Node localhost { ScheduledTask ScheduledTaskDailyAdd { TaskName = 'Test task Daily' TaskPath = '\MyTasks' ActionExecutable = 'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' ScheduleType = 'Daily' DaysInterval = 1 RepeatInterval = '00:15:00' RepetitionDuration = '08:00:00' RestartCount = 2 RestartInterval = '00:05:00' RunOnlyIfNetworkAvailable = $true WakeToRun = $true } } } |