PowerShell is the most powerful tool available to Windows system administrators. Almost anything can be scripted — service checks, disk monitoring, Event Log parsing, scheduled tasks. But the alerts these scripts produce usually go to email or a Teams channel. If nobody is watching at night, the same problem remains.
Calling the Alertalk webhook from PowerShell is a single code block. Any script running on Windows can be turned into a voice alert.
How to Send a Webhook from PowerShell?
PowerShell uses the Invoke-RestMethod cmdlet to send HTTP POST requests. The structure needed to call the Alertalk webhook is as follows:
$webhookUrl = "https://tr.alertalk.net/webhook/receive"
$webhookKey = "your-alertalk-key-here"
$body = @{
phone_number = "5XXXXXXXXX"
error_message = "Your alert message here"
} | ConvertTo-Json
Invoke-RestMethod -Uri $webhookUrl `
-Method POST `
-Headers @{ "X-Webhook-Key" = $webhookKey; "Content-Type" = "application/json" } `
-Body $body
That is all that is needed to trigger an alert.
Service Status Monitoring
A script that triggers a phone call when a Windows service stops:
$webhookUrl = "https://tr.alertalk.net/webhook/receive"
$webhookKey = "your-alertalk-key-here"
$phone = "5XXXXXXXXX"
$hostname = $env:COMPUTERNAME
$services = @("W32Time", "Spooler", "wuauserv")
foreach ($svc in $services) {
$status = (Get-Service -Name $svc -ErrorAction SilentlyContinue).Status
if ($status -ne "Running") {
$body = @{
phone_number = $phone
error_message = "Service alert: $svc on $hostname is not running. Status: $status"
} | ConvertTo-Json
Invoke-RestMethod -Uri $webhookUrl `
-Method POST `
-Headers @{ "X-Webhook-Key" = $webhookKey; "Content-Type" = "application/json" } `
-Body $body
}
}
Disk Usage Alert
$webhookUrl = "https://tr.alertalk.net/webhook/receive"
$webhookKey = "your-alertalk-key-here"
$phone = "5XXXXXXXXX"
$threshold = 85
$hostname = $env:COMPUTERNAME
Get-PSDrive -PSProvider FileSystem | Where-Object { $_.Used -gt 0 } | ForEach-Object {
$total = $_.Used + $_.Free
$usedPercent = [math]::Round(($_.Used / $total) * 100)
if ($usedPercent -ge $threshold) {
$body = @{
phone_number = $phone
error_message = "Disk alert: Drive $($_.Name) on $hostname is at $usedPercent percent."
} | ConvertTo-Json
Invoke-RestMethod -Uri $webhookUrl `
-Method POST `
-Headers @{ "X-Webhook-Key" = $webhookKey; "Content-Type" = "application/json" } `
-Body $body
}
}
Windows Event Log Alert
Triggers a voice call when critical Event Log entries are detected:
$webhookUrl = "https://tr.alertalk.net/webhook/receive"
$webhookKey = "your-alertalk-key-here"
$phone = "5XXXXXXXXX"
$hostname = $env:COMPUTERNAME
$events = Get-EventLog -LogName System -EntryType Error -Newest 10 `
-After (Get-Date).AddMinutes(-10) -ErrorAction SilentlyContinue
if ($events) {
$count = $events.Count
$body = @{
phone_number = $phone
error_message = "Event Log alert: $count critical errors detected on $hostname in the last 10 minutes."
} | ConvertTo-Json
Invoke-RestMethod -Uri $webhookUrl `
-Method POST `
-Headers @{ "X-Webhook-Key" = $webhookKey; "Content-Type" = "application/json" } `
-Body $body
}
Running Automatically with Scheduled Task
To run the script periodically using Windows Task Scheduler:
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
-Argument "-NonInteractive -ExecutionPolicy Bypass -File C:\Scripts\alarm.ps1"
$trigger = New-ScheduledTaskTrigger -RepetitionInterval (New-TimeSpan -Minutes 5) `
-Once -At (Get-Date)
Register-ScheduledTask -TaskName "AlertalkDiskMonitor" `
-Action $action -Trigger $trigger -RunLevel Highest
PowerShell Alert Scenarios
| Scenario | Cmdlet | Difficulty |
|---|---|---|
| Service status | Get-Service | Easy |
| Disk usage | Get-PSDrive | Easy |
| Event Log errors | Get-EventLog | Medium |
| SQL Server connection | Invoke-Sqlcmd | Medium |
| IIS application pool | Get-WebConfiguration | Medium |
Who Is This For?
Ideal for system administrators managing Windows infrastructure. Particularly useful in environments without a dedicated monitoring tool or where specific custom alert scenarios are needed alongside an existing stack. PowerShell and Alertalk together provide a fast and effective solution with no additional software required.
Setup Guide
For creating an Alertalk account and getting your webhook key:
Webhook Integration Documentation