Skip to content
Menu

Drive About to Fail - SMART Health and SSD Wear

Reads each physical disk's health and operational status, wear, temperature, uncorrected read errors, power-on hours and SMART flag, and alerts on a failing or worn disk.

Drive about to fail - SMART health and SSD wear is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review Drive about to fail - SMART health and SSD wear. Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows 10, Windows 11, Windows Server 2016+; runs as SYSTEM
NeedsPowerShell 5.1; administrator rights; Storage module
Read-onlyReads, changes nothing

What It Does

The script is read-only. For each physical disk it reads Get-PhysicalDisk for HealthStatus and OperationalStatus, Get-StorageReliabilityCounter for wear, temperature, uncorrected read errors and power-on hours, and the SMART failure prediction flag in root\wmi, matched to the disk by its PnP device id.

It alerts when a disk's health is Warning or Unhealthy, it reports an operational state outside OK, In Service or Unknown, SMART predicts failure, or wear is at or above WearPercent.

What is not reported is shown as not reported, never as zero. Virtual disks, many USB enclosures, some RAID controllers and many NVMe drives report little or nothing, because the reliability counters and the SMART flag come from the drive and its driver, not from Windows. Such a disk is still checked for health status, and an OK answer says how many disks reported no reliability data. Set RequireReliabilityData to true to alert on a disk that reports nothing, when you cannot accept a blind spot. The SMART flag only exists for ATA and SCSI attached drives.

Before You Run It

  • Know that virtual machines and some RAID controllers report little. Do not read not reported as healthy.
  • Set WearPercent to match the client's replacement policy. The default is 80.
  • Use RequireReliabilityData only where you cannot accept a disk that reports nothing.
  • Schedule it daily in your RMM and alert on exit 1. Run it as an administrator or SYSTEM.

Type and Risk

  • Type: Monitor. It checks one condition. It exits 1 when it finds the problem, so your RMM can alert on it, 0 when all is well, and 2 when it could not run.
  • Risk: Low. It reads and changes nothing.
  • Restart: It never restarts the machine.
  • Typical run: Under 20 seconds.
  • Example answer: "Disk 0 (Samsung SSD 970): wear 86% (limit 80%); SMART predicts failure"
  • Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • WearPercent: Alert when a disk reports that this percent or more of its rated life is used. Whole number, 1 to 100. Default 80.
  • RequireReliabilityData: Alert on a disk that reports no reliability data at all (no wear, temperature, error count, power-on hours or SMART flag). true or false. Default false.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

test-disk-health.ps1 · 850 lines · 43 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.