..so I created this script and have used it on a WinXP PC:
Code:
Break on
If $strComputer = ""
$strComputer = "."
EndIf
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + $strComputer + "\root\cimv2")
If $objWMIService
$colScheduledJobs = $objWMIService.ExecQuery("Select * from Win32_ScheduledJob") ; ,,48)
For Each $objItem In $colScheduledJobs
$name=$objItem.name
$command=$objItem.Command
$days=$objItem.DaysOfWeek
$mstime=$objItem.StartTime
$ro=RedirectOutput("d:\log\"+@WKSTA+".log",0)
? 'task: '+$name+Chr(9)+$command+Chr(9)+$day+Chr(9)+$mstime+Chr(13)+Chr(10)
If $strComputer = "."
$strComputer = @wksta
EndIf
Next
;sleep 10
EndIf
It works but it only shows tasks scheduled by AT and it doesn't show tasks that are scheduled by JT.exe, Schtasks or the Scheduled Tasks GUI. It must be a WMI / Win32_ScheduledJob problem because the following VBscript gives the same output:
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colScheduledJobs = objWMIService.ExecQuery _
("Select * from Win32_ScheduledJob")
For Each objJob in colScheduledJobs
Wscript.Echo "Caption: " & objJob.Caption
Wscript.Echo "Command: " & objJob.Command
Wscript.Echo "Days Of Month: " & objJob.DaysOfMonth
Wscript.Echo "Days Of Week: " & objJob.DaysOfWeek
Wscript.Echo "Description: " & objJob.Description
Wscript.Echo "Elapsed Time: " & objJob.ElapsedTime
Wscript.Echo "Install Date: " & objJob.InstallDate
Wscript.Echo "Interact with Desktop: " & objJob.InteractWithDesktop
Wscript.Echo "Job ID: " & objJob.JobID
Wscript.Echo "Job Status: " & objJob.JobStatus
Wscript.Echo "Name: " & objJob.Name
Wscript.Echo "Notify: " & objJob.Notify
Wscript.Echo "Owner: " & objJob.Owner
Wscript.Echo "Priority: " & objJob.Priority
Wscript.Echo "Run Repeatedly: " & objJob.RunRepeatedly
Wscript.Echo "Start Time: " & objJob.StartTime
Wscript.Echo "Status: " & objJob.Status
Wscript.Echo "Time Submitted: " & objJob.TimeSubmitted
Wscript.Echo "Until Time: " & objJob.UntilTime
Next