---
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:

[How to log in to a Linux server via SSH (Windows / macOS / Linux)](https://zomro.com/blog/faq/688-how-to-login-to-a-linux-server-via-ssh-windows-macos-linux) [Linux dig command - usage and examples.](https://zomro.com/blog/faq/404-linux-d-command-usage-examples) [How to install updates on Windows Server 2012, Windows Server 2016, and Windows Server 2019](https://zomro.com/blog/faq/242-kak-ustanovit-obnovlenija-na-windows-server-2012-2016-2019) [How to add a rule to Windows Server 2012, 2016, 2019 Firewall](https://zomro.com/blog/faq/273-kak-dobavit-pravilo-v-brandmaujer-windows-server-2012-2016-2019) [How to renew the virtual hosting service in the new billing](https://zomro.com/blog/faq/232-prodlenie-uslugi-virtualnogo-hostinga-v-novom-billinge)

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