How to use Microsoft's JT scheduler tool
JT.EXE can be used to manipulate jobs in "Scheduled Tasks".
It is part of Microsoft's Windows 2000 Resource Kit, and can be downloaded from ftp.microsoft.com/reskit/win2000/jt.zip.
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.
For Windows XP and later:
REG Query "\\remote_pc\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v PathName
For Windows 2000 use the following command instead:
REG Query "\\remote_pc\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PathName"
||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
/SJ switch and specify the new values for the
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.
JT /? or use JTHelp for explanations of the available switches.
- /LJ drive\path\job_name.job
- Load a scheduled task file
- /SC domain\user password
- Set credentials for the task
- /SM \\remote_pc
- Specify a remote computer (not for loading remote task file, in that case use UNC path instead)
- /SJ ApplicationName="prog_path Parameters="prog_arguments" WorkingDirectory=path Priority=Idle Interactive=0 DeleteWhenDone=1
- Run specified program prog_path with specified arguments in specified working directory, with low priority, do not interact with the desktop and delete the task when finished
- /STJ StartDate=4/8/2020 StartTime=18:00 Disabled=0 Type=Weekly TypeArguments=1,MF
- Run the job every week on Monday and Friday, 6 PM, starting tomorrow
- /STJ StartDate=4/8/2020 StartTime=06:00 Disabled=0 Type=Once
- Run the job once, tomorrow at 6 AM
- /STJ StartDate=4/8/2020 StartTime=06:00 Disabled=0 Type=MonthlyDOW TypeArguments=2,M,FebAprJunAugOctDec
- Run the job every Monday of the second week of the even months at 6 AM, starting tomorrow
- /STJ StartDate=4/8/2020 Type=AtLogon Disabled=0
- Run the job at each logon, starting tomorrow
- /STJ StartDate=4/8/2020 Type=AtStartup Disabled=0
- Run the job at each system startup, starting tomorrow
- /LJ "%windir%\Tasks\jobname.job /PJ
- List all properties of the specified job
- /LJ "%windir%\Tasks\jobname.job /RJ
- Run the specified job now (can be useful to let "unpriviliged" users run tasks that require administrator credentials)
- /CTJ StartTime=06:00 StartDate=4/8/2020 Type=Daily TypeArguments=1 Disabled=0 /SJ ApplicationName=notepad.exe WorkingDirectory=C:\ /SC domain\user password /SAJ %windir%\Tasks\Newjobname.job
- 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
page last uploaded: 2018-12-28, 15:26