Examples/Resources/ScheduledTask/8-RunPowerShellTaskEvery15MinutesIndefinitely.ps1
<#
.EXAMPLE This example will create a scheduled task that will call PowerShell.exe every 15 minutes indefinitely to run a script saved locally. The task will start immediately. The script will be called as the local system account. #> Configuration Example { param ( [Parameter()] [System.String[]] $NodeName = 'localhost' ) Import-DscResource -ModuleName ComputerManagementDsc Node $NodeName { ScheduledTask MaintenanceScriptExample { TaskName = "Custom maintenance tasks" ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe" ActionArguments = "-File `"C:\scripts\my custom script.ps1`"" ScheduleType = 'Once' RepeatInterval = '00:15:00' RepetitionDuration = 'Indefinitely' } } } |