Created
December 16, 2017 20:34
-
-
Save PlagueHO/c04396780617eb85b41652e5ec8a11dc to your computer and use it in GitHub Desktop.
Create a new scheduled task with no execution time limit on any version on Windows Server 2012 R2 and Windows Server 2016
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$trigger = New-ScheduledTaskTrigger -Once -At '13:00:00' | |
$action = New-ScheduledTaskAction -Execute 'powershell.exe' | |
$settingsSet = New-ScheduledTaskSettingsSet | |
# Set the Execution Time Limit to unlimited on all versions of Windows Server | |
$settingsSet.ExecutionTimeLimit = 'PT0S' | |
$task = New-ScheduledTask -Trigger $trigger -Action $action -Settings $settingsSet | |
Register-ScheduledTask -TaskName 'MyTask' -InputObject $task |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment