'Scheduled Task - Trigger doesn't work after disable/enable with remote PowerShell
I created a Scheduled Task which gets triggered every day every 5 minutes. The task itself works fine.
In our deployment process I stop and disable the task with remote PowerShell from our build server on the target server. We create a backup and copy the new version of our application. After that the scheduled task gets enabled again with remote PowerShell.
After the deployment the scheduled task doesn't get triggered anymore. When I stop and disabled the task manually on the server, copy and paste the new version and then enable again - the trigger works just fine.
Here's a screenshot of the trigger configuration:

And here's the remote PowerShell command:
#doing init stuff
Write-Host "Stop and disable Scheduled Task"
Stop-ScheduledTask -TaskName "\path\task-name"
Disable-ScheduledTask -TaskName "\path\task-name"
#doing deployment stuff
Write-Host "Enable Scheduled Task"
Enable-ScheduledTask -TaskName "\path\task-name"
Notes - OS: Windows Server 2019
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
