Even without a monitoring platform, Windows can watch itself and tell you when something’s wrong. These built-in options are also how you understand what commercial tools do under the hood.
1. Performance counters
Every metric Windows exposes – CPU, memory, disk latency, IIS requests, SQL waits – is a performance counter.
Get-Counter -ListSet * | Select-Object CounterSetName | Sort-Object CounterSetName
Get-Counter -ListSet Processor | Select-Object -ExpandProperty Counter
Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 5 -MaxSamples 3
See Performance troubleshooting for which counters matter and what’s normal.
2. PerfMon alerts
Performance Monitor can raise an alert when a counter crosses a threshold:
perfmon.msc→ Data Collector Sets → User Defined → New → Data Collector Set.- Choose Create manually → Performance Counter Alert.
- Add a counter, e.g.
\LogicalDisk(C:)\% Free Space, alert when Below 10. - In the alert’s properties, Alert Action: log an entry to the Application event log, and/or Alert Task: start a scheduled task (for example, a script that sends a notification).
- Start the collector set and set it to start with the system.
3. Act on events with Task Scheduler
You can run a task whenever a specific event is logged – for example when a service stops unexpectedly (System log, event ID 7034):
- Open Event Viewer, find a 7034 event.
- Right-click → Attach Task To This Event.
- Choose Start a program →
powershell.exewith arguments like-NoProfile -File D:\Scripts\Notify-ServiceStop.ps1.
Now every unexpected service stop triggers your script.
4. A scheduled health-check script
The most flexible option: a PowerShell script that checks what matters and records the result, run every 15 minutes by Task Scheduler.
# D:\Scripts\Health-Check.ps1
$problems = @()
# Disks below 10% free
Get-CimInstance Win32_LogicalDisk -Filter "DriveType=3" | ForEach-Object {
$pct = [math]::Round($_.FreeSpace / $_.Size * 100)
if ($pct -lt 10) { $problems += "Disk $($_.DeviceID) only $pct% free" }
}
# Automatic services that aren't running (ignore ones that stop by design)
$ignore = 'gupdate','sppsvc','RemoteRegistry','MapsBroker'
Get-CimInstance Win32_Service -Filter "StartMode='Auto' AND State<>'Running'" |
Where-Object Name -notin $ignore |
ForEach-Object { $problems += "Service $($_.Name) is $($_.State)" }
# Errors in the System log in the last 15 minutes
$errs = Get-WinEvent -FilterHashtable @{ LogName='System'; Level=1,2; StartTime=(Get-Date).AddMinutes(-15) } -ErrorAction SilentlyContinue
if ($errs) { $problems += "$($errs.Count) System error(s) in the last 15 minutes" }
if ($problems) {
$msg = "$env:COMPUTERNAME health check:`n" + ($problems -join "`n")
# Write to a custom event source so central tools can pick it up
if (-not [System.Diagnostics.EventLog]::SourceExists('HealthCheck')) {
New-EventLog -LogName Application -Source HealthCheck
}
Write-EventLog -LogName Application -Source HealthCheck -EventId 9001 -EntryType Warning -Message $msg
}
Register it to run every 15 minutes:
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-NoProfile -File D:\Scripts\Health-Check.ps1'
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 15)
Register-ScheduledTask -TaskName 'Health Check' -Action $action -Trigger $trigger -User 'SYSTEM' -RunLevel Highest
(New-EventLog/Write-EventLog are Windows PowerShell 5.1 cmdlets – run this script with powershell.exe, as above.)
Writing to the event log rather than sending mail directly means any log collector – Windows Event Forwarding or your monitoring agent – can turn event 9001 into an alert.
The limits of built-in monitoring
These tools work per server. With more than a handful of servers you want:
- one place to see all servers’ health,
- history and trends,
- alert routing to the right team.
That’s what centralised logging and metrics tools provide – see Centralise Windows logs and Prometheus and Grafana for Windows.
What’s next
Next: Centralise Windows logs with Event Forwarding.
Practise this topic
Test yourself with free questions on this topic – instant answers and explanations.
Start practice questionsMonitoringWindows ServerPerfMonEvent LogsPowerShellBeginner