Created
December 16, 2017 20:41
-
-
Save PlagueHO/15120718e869c0f5f281e43f378bc5b0 to your computer and use it in GitHub Desktop.
Create a new scheduled task with no execution time limit on 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' | |
# Set the Execution Time Limit to unlimited on Windows Server 2016 | |
$settingsSet = New-ScheduledTaskSettingsSet -ExecutionTimeLimit '00:00:00' | |
$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