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.
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.
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
schtasks /run /s ComputerName /tn “description”
“$counter – Running script”
} While ($counter –lt 30)
Consider Using Action1 to Run Scheduled Task on Remote Computer if:
- You need to perform an action on multiple computers simultaneously.
- You have remote employees with computers not connected to your corporate network.