Recipe 10.13. Viewing Scheduled
You want to view the list of scheduled tasks on a system.
Using a graphical
From the Control Panel,
the Scheduled Task applet.
Using a command-line interface
The following command lists the scheduled tasks:
> schtasks /query
To get detailed information about each task, run the following command:
> schtasks /query /v /fo list
' This code lists the scheduled AT tasks on a computer.
' ------ SCRIPT CONFIGURATION ------
strComputer = "
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
set colScheduledJobs = objWMI.ExecQuery("Select * from Win32_ScheduledJob")
for each objJob in colScheduledJobs
WScript.Echo "Job ID: " & objJob.JobID
for each objProp in objJob.Properties_
WScript.Echo " " & objProp.Name & ": " & objProp.Value
Another quick way to view the scheduled tasks on a system is to simply browse the
share point on the system (
). When you create a scheduled task, a job file is created that contains the settings for the task, which is placed in
. This directory is shared out as
. Unfortunately, the job files are stored in a binary format, so you cannot simply create or modify them with a text editor. You can, however, copy and paste jobs between machines. If you want to copy a job from HostA to HostB, open the Scheduled Tasks share point on both servers, right-click on the target job on HostA and select Copy, then paste the copy into the
share of HostB. Make sure any localized settings in the task are modified on HostB after the copy is complete.
Recipe 10.12 for creating a scheduled task; Recipe 10.14 for deleting a scheduled task; MS KB 310424, "HOW TO: Work with Scheduled Tasks on Remote Computers in Windows XP"