I need to backup Task Scheduler Tasks. These are already grouped into one subfolder within the Task Scheduler. But the only way I found, is to use
schtasks.exe /query /tn "<path>\<taskname>"
With that I have to specify every single task… but these could be different on different machines.
I'm searching for a simple way to use a wildcard.
E.g.
schtasks.exe /query /tn "<path>\*"
Is there a way, to
- not export the whole list? (I really don't care about Microsofts own
tasks like \Microsoft\Windows\Wininet\CacheTask) - export a whole folder?
Best Answer
Use Powershell. On Windows Server 2008 R2 , you can use the following code;
This will export all the tasks under "CustomTasks" folder to C:\Temp folder and file names will be "WhateverTheTaskNameIs.xml" .
For Windows Server 2012 and later, you can use
Get-ScheduledTask
andExport-ScheduledTask
cmdlets.