How to Configure Disk Health Monitoring on Windows Server 2012 R2
Disk failures are one of the most common causes of data loss and unplanned downtime in server environments. Windows Server 2012 R2 provides several built-in mechanisms for monitoring disk health including SMART (Self-Monitoring, Analysis and Reporting Technology) data, storage subsystem event logs, Windows Storage Spaces health monitoring, and integration with Windows Server hardware management interfaces. Proactive disk health monitoring allows administrators to detect failing drives and schedule replacement before they fail catastrophically and take down a server or corrupt data. This guide covers configuring disk health monitoring using built-in Windows tools and PowerShell scripts.
Prerequisites
Administrator privileges are required. For SMART monitoring, the physical disk controllers must support SMART and the Windows storage stack must be able to query SMART data — this works for directly attached SATA and SAS drives, but SMART data may not be passable through hardware RAID controllers (vendor-specific tools are needed for RAID HBA-managed drives). For Storage Spaces, the appropriate disks must be added to the storage pool before health monitoring applies.
Step 1: Check Physical Disk Health via PowerShell
Windows Server 2012 R2 includes the Storage module with cmdlets for querying disk health through the Windows Storage Management API:
# Get health status of all physical disks
Get-PhysicalDisk | Select-Object FriendlyName, MediaType, Size, HealthStatus, OperationalStatus | Format-Table -AutoSize
# Get detailed disk information
Get-PhysicalDisk | Format-List *
# Get disk reliability counters (SMART data where available)
Get-PhysicalDisk | Get-StorageReliabilityCounter | Select-Object DeviceId, ReadErrorsCorrected, ReadErrorsUncorrected, WriteErrorsUncorrected, StartStopCycleCount, PowerOnHours, Wear | Format-Table -AutoSize
The HealthStatus field returns “Healthy”, “Warning”, or “Unhealthy”. An Unhealthy status requires immediate attention. The StorageReliabilityCounter provides SMART-derived statistics — ReadErrorsUncorrected greater than zero indicates a serious disk problem.
Step 2: Monitor Disk SMART Data via WMI
Query SMART status through WMI for broader compatibility with different disk types:
# Query SMART status via WMI
$smartData = Get-WmiObject -Namespace rootwmi -Class MSStorageDriver_FailurePredictStatus
foreach ($disk in $smartData) {
$diskInfo = [PSCustomObject]@{
InstanceName = $disk.InstanceName
PredictFailure = $disk.PredictFailure
Reason = $disk.Reason
}
Write-Host "Disk: $($diskInfo.InstanceName)"
Write-Host " Predict Failure: $($diskInfo.PredictFailure)"
if ($diskInfo.PredictFailure) {
Write-Warning " SMART indicates imminent disk failure! Reason code: $($diskInfo.Reason)"
}
}
PredictFailure = $true is a critical warning from the disk’s own SMART firmware that the drive is likely to fail soon. Back up data immediately and schedule hardware replacement.
Step 3: Monitor Disk Event Log for Storage Errors
The System event log records disk-related errors from the disk driver and storage subsystem. Monitor for critical disk error events:
# Check for disk errors in the System event log (last 24 hours)
$diskErrorEvents = Get-WinEvent -LogName System | Where-Object {
$_.TimeCreated -gt (Get-Date).AddHours(-24) -and
$_.ProviderName -in @("disk", "Ntfs", "volmgr", "partmgr", "atapi", "iaStor", "stornvme") -and
$_.LevelDisplayName -in @("Error", "Critical", "Warning")
}
$diskErrorEvents | Select-Object TimeCreated, ProviderName, Id, LevelDisplayName, Message | Format-List
# Key disk-related event IDs to watch for:
# Event ID 7 (disk) - disk had a bad block
# Event ID 9 (disk) - device did not respond
# Event ID 11 (disk) - driver detected a controller error
# Event ID 51 (disk) - paging error during write/read
# Event ID 55 (Ntfs) - NTFS file system structure corruption
Step 4: Run CHKDSK for File System Integrity
CHKDSK verifies and repairs NTFS file system integrity. Run a read-only check on a live volume without interrupting access:
# Read-only CHKDSK on D: volume (does not require exclusive access)
chkdsk D: /scan
# Schedule CHKDSK for boot time on the system volume (cannot run live on C:)
chkdsk C: /f /r /b
# PowerShell equivalent using Repair-Volume
Repair-Volume -DriveLetter C -Scan
Repair-Volume -DriveLetter D -Scan
The /r switch repairs bad sectors by locating them and recovering readable information. The /b switch re-evaluates all bad clusters (useful after replacing a disk in a RAID set). Schedule CHKDSK reports regularly and investigate any reported bad sectors immediately.
Step 5: Monitor Storage Spaces Health
If your server uses Windows Storage Spaces (pool of physical disks presenting virtual disks), monitor the storage pool and virtual disk health:
# Get storage pool health
Get-StoragePool | Select-Object FriendlyName, HealthStatus, OperationalStatus, IsReadOnly | Format-Table -AutoSize
# Get virtual disk health
Get-VirtualDisk | Select-Object FriendlyName, HealthStatus, OperationalStatus, ResiliencySettingName | Format-Table -AutoSize
# Get detailed virtual disk operational status (check for degraded/failed)
Get-VirtualDisk | Where-Object {$_.HealthStatus -ne "Healthy"} | Format-List *
# Force Storage Spaces to repair a degraded virtual disk
Repair-VirtualDisk -FriendlyName "DataVolume1" -Confirm:$false
Step 6: Create an Automated Disk Health Monitoring Script
Schedule a daily disk health check that alerts on any concerning conditions:
$report = "Disk Health Report - $env:COMPUTERNAME - $(Get-Date)`n"
$report += "="*60 + "`n"
$alertNeeded = $false
# Physical disk health
$disks = Get-PhysicalDisk
$report += "`nPHYSICAL DISKS:`n"
foreach ($disk in $disks) {
$status = "$($disk.FriendlyName): $($disk.HealthStatus) / $($disk.OperationalStatus)"
$report += " $status`n"
if ($disk.HealthStatus -ne "Healthy") {
$alertNeeded = $true
$report += " *** ALERT: Disk health is $($disk.HealthStatus) ***`n"
}
}
# SMART failure prediction
$smartFails = Get-WmiObject -Namespace rootwmi -Class MSStorageDriver_FailurePredictStatus | Where-Object {$_.PredictFailure -eq $true}
if ($smartFails) {
$alertNeeded = $true
$report += "`nSMART FAILURE PREDICTED on:`n"
$smartFails | ForEach-Object { $report += " $($_.InstanceName)`n" }
}
# Disk errors in last 24 hours
$diskErrors = Get-WinEvent -LogName System -ErrorAction SilentlyContinue | Where-Object {
$_.TimeCreated -gt (Get-Date).AddHours(-24) -and
$_.ProviderName -eq "disk" -and
$_.Id -in @(7, 9, 11, 51)
}
if ($diskErrors.Count -gt 0) {
$alertNeeded = $true
$report += "`nDISK ERRORS IN LAST 24 HOURS: $($diskErrors.Count)`n"
$diskErrors | Select-Object -First 5 TimeCreated, Id, Message | ForEach-Object { $report += " [$($_.TimeCreated)] ID$($_.Id): $($_.Message.Substring(0, [Math]::Min(100, $_.Message.Length)))`n" }
}
# Volume free space check
Get-WmiObject Win32_LogicalDisk -Filter "DriveType=3" | ForEach-Object {
$pctFree = [math]::Round($_.FreeSpace / $_.Size * 100, 1)
$freeMB = [math]::Round($_.FreeSpace / 1MB, 0)
$report += "`nVolume $($_.DeviceID): $pctFree% free ($freeMB MB)`n"
if ($pctFree -lt 10) {
$alertNeeded = $true
$report += " *** ALERT: Low disk space! ***`n"
}
}
Write-Host $report
if ($alertNeeded) {
Send-MailMessage -SmtpServer "smtp.yourdomain.com" -From "[email protected]" -To "[email protected]" -Subject "DISK HEALTH ALERT: $env:COMPUTERNAME" -Body $report
}
Step 7: Schedule Disk Health Monitoring
$script | Out-File "C:ScriptsDiskHealthCheck.ps1" -Encoding UTF8
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NonInteractive -ExecutionPolicy Bypass -File C:ScriptsDiskHealthCheck.ps1"
$trigger = New-ScheduledTaskTrigger -Daily -At 6am
Register-ScheduledTask -TaskName "Daily Disk Health Check" -Action $action -Trigger $trigger -RunLevel Highest -User "SYSTEM"
Summary
Disk health monitoring on Windows Server 2012 R2 combines SMART data queries, Windows Storage Management API health status checks, event log analysis for driver-level errors, and regular CHKDSK scans into a comprehensive early warning system for disk failures. By automating daily health checks with PowerShell and alerting on any anomalies — SMART failure prediction, elevated uncorrectable read errors, or driver-level I/O errors — administrators gain enough advance warning to schedule proactive disk replacement during planned maintenance rather than performing emergency data recovery after a catastrophic drive failure.