You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that we have a function Setup-ScheduledTask to import tasks from json to Scheduler, it'll be great to have a reverse function to Export-ScheduledTask from Scheduler to same-format json, with all default settings omitted. Just like the official builtin one. Cause apperarently its format of xml is not compatible with this project, and it's output is way too redundant with all settings (event default) exported.
Then I can build up a git-tracked tasks configuration workflow: just Export all my current tasks to a json file for the frist time, include it in a git repo, and whenever I make a change, I can just run a script to delete all my tasks and re-Setup all over again.
The text was updated successfully, but these errors were encountered:
Like you said, one reason this feature would be useful for those who want to begin to source-control simpler Task using our this project's Task spec. Another reason I can think of is that there is no inbuilt Import-ScheduledTask cmdlet so using the native Export-ScheduledTask is really just making a XML backup which has to be restored to Task Scheduler via the GUI. In contrast, our version of Export-ScheduledTask only has to be run once by a user to serialize those tasks as JSON documents, and supports non-interactive setting up of scheduled tasks based on the JSON Task objects.
If we are going to create this serializer, we are going to have to parse all Task Objects returned by Get-ScheduledTasks, and convert each task to this spec, and finally serializing this to a JSON or YAML which can be source-controlled in a git repo.
@WestXu this will require some work, but it shouldn’t be too tough. One thing if I recall rightly, is that we might have some trouble with converting schedules in the Task Scheduler which are supported by schtasks.exe with /SC flag but there is no flag for monthly schedule for New-ScheduledTaskTrigger. Small inconsistencies might make converting the Task schedule a more challenging.
Great project!
Now that we have a function
Setup-ScheduledTask
to import tasks from json to Scheduler, it'll be great to have a reverse function toExport-ScheduledTask
from Scheduler to same-format json, with all default settings omitted. Just like the official builtin one. Cause apperarently its format of xml is not compatible with this project, and it's output is way too redundant with all settings (event default) exported.Then I can build up a git-tracked tasks configuration workflow: just
Export
all my current tasks to a json file for the frist time, include it in a git repo, and whenever I make a change, I can just run a script to delete all my tasks and re-Setup
all over again.The text was updated successfully, but these errors were encountered: