---
title: 'Monitoring server availability via Windows Scheduler | Zomro'
description: 'To set up a task in Windows Task Scheduler using PowerShell and run your script every 10 minutes'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/09/03/001_vhEb47L.png'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * Monitoring server availability via Windows Scheduler 



# Monitoring server availability via Windows Scheduler

03-09-2023

To set up a task in Windows Task Scheduler using PowerShell to run your script every 10 minutes, follow these steps:

  1. First, save your script to a file, such as `C:\path\to\your\script.ps1`.

  2. Run PowerShell as an administrator.

  3. Use the following command to create the job:



    
    
     $action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File C:\path\to\your\script.ps1'
    
    $trigger = New-ScheduledTaskTrigger -AtStartup -RepetitionInterval ([TimeSpan]::FromMinutes(10)) -RepetitionDuration ([TimeSpan]::FromDays(36500))
    
    Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "YourTaskName" -Description "Description of your task"

![Monitoring server availability via Windows Scheduler - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/09/03/001_vhEb47L.png)

In this code:

  * `-Execute 'powershell.exe'`: specifies to execute `powershell.exe`.

  * `-Argument`: the arguments that are passed to PowerShell. This tells PowerShell to run your script without an interactive shell and bypass the runtime policy (which may be required for automatic script execution).

  *   * `-AtStartup`: start the job at startup (you can change this to a different point in time if you want).

  * `-RepetitionInterval`: repeat the job every 10 minutes.

  * `-RepetitionDuration`: the duration of the repetition (this is set to 24 hours, but you can change this or omit it altogether to run the job indefinitely).

  * `YourTaskName`: the name of your job in the job scheduler. You can change it to something more appropriate.




After executing this command, a job will be created and will start running every 10 minutes. You can check and manage the task through the Task Scheduler GUI in Windows.

![Monitoring server availability via Windows Scheduler - 2](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/09/03/01_suZFVTl.png)

![Monitoring server availability via Windows Scheduler - 3](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/09/03/02_Z2Y8KPg.png)

![Monitoring server availability via Windows Scheduler - 4](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/09/03/03_8MX5hTa.png)

If you want to view all jobs created in the job scheduler, use the command:
    
    
     Get-ScheduledTask | Format-Table -Property TaskName,State

#### 

![Monitoring server availability via Windows Scheduler - 5](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/09/03/04_RuOrxbm.png)

#### **Deleting a Task**

To delete a task, use the command:
    
    
     Unregister-ScheduledTask -TaskName "YourTaskName" -Confirm:$false

#### **Change Task**

If you decide to make changes to an already created task, it is best to delete the old task and create a new one with updated parameters.

### **Closure**

Server monitoring — a critical task to ensure the stability of your IT infrastructure. Using the Windows Job Scheduler in combination with PowerShell, you can automate checks and notifications, quickly tracking down potential problems. However, this approach requires care and a security conscious approach to prevent vulnerabilities.

Similar articles:

[Upgrading and downgrading PHP on CentOS 7](https://zomro.com/blog/faq/434-upgrading-and-downgrading-php-on-centos-7) [How to install Wordpress in Docker-Compose](https://zomro.com/blog/faq/376-how-to-install-wordpress-in-docker-compose) [Installing the VestaCP panel](https://zomro.com/blog/faq/327-ustanovka-paneli-vestacp) [Install ffmpeg-php on Centos 7 and Ubuntu 20](https://zomro.com/blog/faq/345-install-ffmpeg-php-on-centos-7-and-ubuntu-20) [How to change the PHP version in the HestiaCP panel?](https://zomro.com/blog/faq/246-kak-smenit-versiju-php-v-paneli-hestiacp)

[ Forex Server from €7.95/mon ](/server-for-forex)
