A Quick Tip To Check Schedule Tasks On Remote Computers

by [Published on 15 Dec. 2010 / Last Updated on 31 Oct. 2009]

This article explains how you can use Schtasks.exe with Psexec.exe to check schedule Tasks on remote computers.

You have created a schedule task using the Group Policy on all the domain client computers or servers. You need to verify to make sure this Task has been created on all the computers. Let's say the Task name is BatchJob. Group Policy does not provide reporting. You need to use the below mentioned script to accomplish this:


  • Create a text file and name it as CompList.TXT
  • Put all the computer or Server names in it.
  • Next, put the following lines in a file as it as CheckTasks.CMD
  • REM ***START HERE***
  • @ Echo Off
  • SETLOCAL EnableDelayedExpansion
  • Echo Computer Name, Task Created or Not? >> Result.CSV 
  • FOR /F "Tokens=*" %%L IN (CompList.TXT) DO (
  •    SET CompName=
  •    SET CompName=%%L
  •    Psexec.exe \\!CompName! C:\Windows\System32\Schtasks.exe /query > OutPut.txt
  •    Find /i "BatchJob" < OutPut.txt
  •    IF !ErrorLevel! == 0 (
  •        Echo !CompName!, Yes >> Result.CSV
  •    ) ELSE (
  •        Echo !CompName!, No >> Result.CSV
  •    )
  • )
  • REM ***END HERE***

The script runs against each server or computer mentioned in the CompList.TXT. It runs Schtasks.exe command with the help of Psexec.exe to execute it remotely and output is gathered in the OutPut.txt. Next command searches for BatchJob in the output.Txt. The end result is stored in a CSV file called Result.CSV.

Download Psexec.exe from here:


Featured Links