Sometimes we required scheduling the task to run in the background as a background process like schedule email, database backup, run script, User notification etc. Window Task Scheduler is the best way to run the schedule processes or the tasks.
Here I explain how to schedule the task to call a URL with Windows Task Scheduler. You can setup Task scheduler in local as well as remote server to execute your scheduler tasks.
To call a URL using Windows Task Scheduler, PowerShell would be the way to go. Here’s a simple one-liner that you can use to create a scheduled task, without needing to write a separate .ps1 file:
powershell -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadString(\"http://jigneshdarji.com/page\")"
Steps: how to schedule a task to call a URL with Windows Task Scheduler
Step 1: Open up Task Scheduler
Step 2: Click “Create Task”
Step 3: Enter a meaningful name i.e. “Change Order Status” and ensure that it runs whether you’re logged in or not (you will need to enter your username and password to save)
Step4: Create a new Trigger (under the Triggers Tab)
Step 5: Set the trigger to run “Daily”, start at some point in the future, repeat every “10 minutes”. Pro Tip: Did you know you can change this to “1 minute” if you want by typing it in? Set it to repeat for a duration of “Indefinitely”.
Step 6: Click the “OK” button
Step 7: Click the “Actions” tab and create a new action
Step 8: Type “powershell” into the “Program/script” box and then “-ExecutionPolicy unrestricted -Command “(New-Object Net.WebClient).DownloadString(\”http://jigneshdarji.com/page\”)” into the “Add arguments” box (changing the URL to whatever it is you need to hit).
Set
Program/ script :PowerShell
Add Arguments:
-ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadString(\"http://jigneshdarji.com/page\")"
Step 9: Click the “OK” button to return to the “Actions” window
Step 10: Click the “OK” button to save and close the Task window
That’ll now mean that task runs every day at 10-minute intervals as long as the computer is on until you disable it.