HOWTO: Run Scheduled Task on Windows Remote Computer

For scheduling and automatic execution of tasks in the Windows environment, the standard Task Scheduler tool is provided, which ensures that pre-prepared tasks are performed at a specific time, or when certain events occur, either once or at intervals, in the context of system or user accounts. In other words, using the Task Scheduler, you can schedule or perform a certain event, perform previously prepared actions, for example, check for updates, synchronize the clock on the time server when any user logs on, turn off or restart the computer, create a system restore point and etc. Starting from Windows Vista, Task Scheduler has become the main system maintenance tool, without which its normal operation is impossible. To manage scheduled tasks in a graphical user interface environment, the Microsoft Management Console (MMC) with the taskschd.msc module or the Schtask.exe command line utility can be used.

Sometimes you may want to create or work with scheduled tasks on remote computers running on Windows. For example, you may want to create a scheduled task on a remote computer then use your computer to manipulate it as and when you require without needing to physically go to the remote computer. The following article shows you how you can run scheduled task on remote computer.

1. You Must Ensure the Following Before You Begin

  • Your computer and the remote computer must be part of a domain or a Workgroup
  • You must know the IP Address of the remote computer
  • You must have the login credentials for the remote computer and the login credential must be part of the Administrators group on the remote computer.
  • You may want to ensure that your Firewall allows “Remote Scheduled Tasks Management” – Screenshot below.

Check options

2. Creating or Managing a Scheduled Task on a Remote Computer

  • - Open Task Scheduler Windows Interface (On Windows 7: Start | Type “Task Scheduler” in search field.)
  • - Right click on Task Scheduler | Click on “Connect to Another Computer”
  • - Supply the IP Address of the remote PC | Select “Connect as another user:” and click on “Set User”
  • - Enter the username and password for the remote PC you want to connect to.

You now have access to the Tasks Scheduler in the remote PC and are able create new tasks or manipulate the existing tasks on the remote PC.

Creating or Managing a Scheduled Task

3. Run Scheduled Task with Powershell

Run the following in Powershell with appropriate permissions:
schtasks /run /s ComputerName /tn "description"
If you want to loop it so it runs manually every 30 minutes, run the following:
#When the counter reaches 30, that’s 15 hours
$counter = 0
Do{
schtasks /run /s ComputerName /tn "description"
sleep 1800
$counter++
“$counter – Running script”
} While ($counter –lt 30)

Also consider using Action1 to run scheduled task on remote computer if:

  • - You need to perform this action on multiple (hundreds or even thousands) computers simultaneously.
  • - Some of your endpoints are laptops not connected to corporate network at all times.

Action1 is a cloud-based platform for software deployment, software/hardware inventory, patch management, endpoint configuration and more. It is free with basic functionality.


Other Relevant HOWTOs: