Using Schtasks.exe and NetViewC.bat, I have scripted ScheduleCSV.bat to generate a CSV (Coma Separated Value) file containing all the scheduled jobs on all of the computers in a domain.

NOTE: Tip 4806 » Windows XP contains a full featured command-line scheduler.

NOTE: Tip 5335 » Can I use the Windows XP command line scheduler in Windows 2000?

The each line in the CSV file contains the following information about a scheduled job:

"Next Run Time"
"Last Run Time"
"Last Result"
"Task To Run"
"Start In"
"Scheduled Task State"
"Scheduled Type"
"Start Time"
"Start Date"
"End Date"
"Run As User"
"Delete Task If Not Rescheduled"
"Stop Task If Runs X Hours and X Mins"
"Repeat: Every"
"Repeat: Until: Time"
"Repeat: Until: Duration"
"Repeat: Stop If Still Running"
"Idle Time"
"Power Management"
The syntax for using ScheduleCSV.bat is:



<b>CSVFile</b>         is the fully qualified <b>CSV</b> file path.

<b>NetBIOS_DOMAIN</b>  is the <b>NetBIOS</b> domain name, like <b>JSIINC</b>.

<b>USER_SAMID</b>      is the User Logon ID, like <b>Jerry</b>, of a domain administrator account.

<b>PASSWORD</b>        is the password of the <b>USER_SAMID</b> account.
ScheduleCSV.bat contains:
@echo off
if \{%4\}==\{\} @echo Syntax: ScheduleCSV CSVFile NetBIOS_DOMAIN USER_SAMID PASSWORD&goto :EOF
set out="%TEMP%\ScheduleCSV_%RANDOM%.TMP"
set csvfile=%1
set dom=%2
set user=%3
set pwd=%4
set work=%dom%\%user%
set user="%work:"=%"
set Head=N
if exist %csvfile% del /q %csvfile%
for /f "Tokens=*" %%c in ('netviewc %dom%') do (
 if "!Head!" EQU "Y" schtasks /query /S "%%c" /U %user% /P %pwd% /FO CSV /NH /V>>%out%
 if "!Head!" EQU "N" set Head=Y&schtasks /query /S "%%c" /U %user% /P %pwd% /FO CSV /V>%out%
for /f "Tokens=*" %%a in ('type %out%') do (
 @echo %%a>>%csvfile%
del /q %out%