JT works in Windows 2000 and later versions.
For Windows XP and later you may want to consider using the native SCHTASKS command instead.
For querying individual tasks, however, JT is the only option.
Though a great and powerful tool, JT doesn't seem to be very popular with administrative scripters.
A good reason for that may be its overwhelming list of switches, and the fact that its syntax cannot seriously be called intuitive.
On this page I will show you some tricks to help you create your own JT command lines, that can then be used in your batch files.
Let's start with the easiest method, distributing an existing job to remote computers.
Copy and modify .job files
Open the "Scheduled Tasks" applet in the "Control Panel" and interactively create the job that you want to script.
Navigate to the %windir%\Tasks folder and find the .job file you just created.
Distribute this .job file to the %windir%\Tasks folders on the remote computers (read the note below).
Now if you were to open the "Scheduled Tasks" applet on the remote computer, you would notice that the job is already listed.
However, it cannot be run yet, because the proper credential need to be set first.
This is where JT comes to the rescue:
JT /LJ "\\remote_pc\remote_windir\Tasks\task_we_just_copied.job" /SC domain\user password
It is bad practice to assume the path of the remote Windows folder.
Use REG to find the actual path of the Windows folder on the remote computer.
This technique assumes that the paths to the program called by the task and the working directory are equal on all computers involved.
It is always risky to assume anything, so you should check to make sure.
If you need to change the path to the program, use JT's /SJ switch and specify the new values for the ApplicationName and WorkingDirectory properties.
Query a .job file's properties
Interactively create a .job file as explained above.
Read the .job file's properties with one or more of the following commands.
List all properties for the task: JT /LJ "%windir%\Tasks\name_of_job_just_created.job" /PJ
List the trigger(s) properties only: JT /LJ "%windir%\Tasks\name_of_job_just_created.job" /PTJ
Display the credentials used (without the password): JT /LJ "%windir%\Tasks\name_of_job_just_created.job" /GC
Use the resulting property values to build a proper JT command line.
Type JT /? or use JTHelp for explanations of the available switches.
Load a scheduled task file
/SC domain\user password
Set credentials for the task
Specify a remote computer (not for loading remote task file, in that case use UNC path instead)
Create a new job which runs daily at 6 AM, starting tomorrow; it will start Notepad with working directory C:\ and will run with domain\user's credentials; save it as Newjobname.job on the local computer