I'm trying to list the names of the Scheduled Tasks on my 64-bit Win 2008 server so I can export them. I discovered that I can easily export them as XML files, all at once (in which case they can't be imported on another machine), or individually by name with the following command-line syntax:
Output all tasks:
Output single task by name:
If I can build a list of task names I can then output each to XML by name; there doesn't seem to be a way to do this via the 'schtasks' command.
I tried the following WMI script but apparently it doesn't list jobs I've created via the Scheduled Task interface (either that or it doesn't work on 64-bit):
Output all tasks:
Code:
schtasks /Query /XML >[desired output path & XML filename]
Output single task by name:
Code:
schtasks /Query /XML /TN [Task name] >[desired output path & XML filename, which should be synonymous with task name]
If I can build a list of task names I can then output each to XML by name; there doesn't seem to be a way to do this via the 'schtasks' command.
I tried the following WMI script but apparently it doesn't list jobs I've created via the Scheduled Task interface (either that or it doesn't work on 64-bit):
Code:
strComputer = "."
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colScheduledJobs = objWMI.ExecQuery("Select * from Win32_ScheduledJob")
for each objJob in colScheduledJobs
MsgBox objJob.Name
next