Reads SMART data from USB-attached SSDs (and HDDs) on Windows and prints a condition label for each drive on a label printer — built for refurbishing and testing drives at scale: plug a drive into a USB dock, and a label rolls out of the printer.
Each label shows the verdict (GOOD / CHECK / BAD), model, serial number (as text and as a scannable Code 39 barcode), capacity, drive type (SATA/NVMe SSD or HDD), remaining endurance in %, temperature, power-on hours, power cycle count, total bytes written, and the test date.
- Zero dependencies: a single PowerShell script that runs on any stock Windows 10/11 machine. No runtime to install; labels print through the regular Windows printer driver.
- Automatic smartctl setup: downloads and installs smartmontools on first run.
- USB bridge support: tries SAT and the common USB-to-NVMe bridge protocols (ASMedia, JMicron, Realtek) automatically. Detects drives via both WMI and the Windows Storage layer, so docks that report themselves as SCSI are still recognized as USB.
- Assembly-line mode: leave the window open, plug drives in one after another, labels print automatically.
- Dead-drive labels: press a key to print a BAD label for a drive that is not detected at all.
- Self-scaling label design: layout adapts to any label size; barcode is omitted automatically when there is no room to print it legibly.
- Audit trail: every tested drive is appended to a semicolon-separated CSV log, and a PNG copy of every label is kept.
- Windows 10 or 11
- A USB dock or adapter for the drives (must support SMART passthrough; virtually all modern docks do)
- A label printer installed as a normal Windows printer (DYMO, Brother, NIIMBOT-style, Zebra, ...). Default label size is 89 x 28 mm die-cut labels; any size works via configuration.
- Administrator rights (required for low-level disk access; the script requests elevation itself via UAC)
- Internet access once, to download smartmontools
- Copy this folder to the Windows machine (or
git cloneit), for example toC:\SmartLabel. Avoid spaces in the path if possible. - Connect the label printer and install its Windows driver, so it shows up as a regular Windows printer.
- Set the label size in the printer driver to the loaded label roll (default assumed here: 89 x 28 mm).
- Double-click
SmartLabel.cmdand confirm the one-time smartctl download. - Run
SmartLabel.cmd -ListPrintersto find the exact printer name and put it inconfig.jsonunderPrinterName. If left empty, the Windows default printer is used. - Double-click
Print-Testlabel.cmdto print a test label and check the layout and alignment.
| Launcher | What it does |
|---|---|
SmartLabel.cmd |
Reads all connected USB drives, shows the results, and asks per drive whether to print its label. |
SmartLabel-Loop.cmd |
Assembly-line mode: leave the window open, plug in a drive and its label prints automatically. Disconnect, plug in the next one, repeat. Every newly plugged-in drive is picked up, even when the dock does not report a USB bus. Press S to print a BAD label for a drive that is not detected at all (dead); Q quits. |
Print-Testlabel.cmd |
Prints a test label with sample data (calibration). |
If no USB drives are found in normal mode, the tool lists all remaining drives (with their bus type) and asks which ones to check.
Useful options (append to any launcher, e.g. SmartLabel.cmd -PreviewOnly):
| Option | Meaning |
|---|---|
-PreviewOnly |
Do not print; opens a PNG preview of the label instead. |
-AutoPrint |
Print without asking for confirmation. |
-AllDrives |
Also include internal (non-USB) drives; the Windows system disk is always skipped. |
-DefectLabel |
Immediately print a BAD label without data ("DEFECTIVE SSD - Not readable"), for a drive that is not detected at all. |
-ListPrinters |
Lists all installed printers. |
-DiskIndex <n> |
Only process the drive with this Windows disk number. |
-PrinterName "..." |
Use a different printer than configured, for this run only. |
| Setting | Meaning |
|---|---|
PrinterName |
Exact name of the label printer in Windows. Empty = default printer. |
LabelWidthMm / LabelHeightMm |
Label size in millimeters (default 89 x 28). The design scales automatically to other sizes. |
Footer |
Text printed in the bottom-right corner of the label. Empty = no footer. |
Rotation |
auto (default): the design rotates 90 degrees automatically when the driver defines the label in portrait. If a label still comes out rotated or clipped, pin this to on or off. |
Barcode |
true/false: print a Code 39 barcode of the serial number. Omitted automatically when there is not enough room. Scan one label after first setup to verify. |
AutoPrint |
true = never ask for confirmation. |
Copies |
Number of labels per drive. |
SmartctlTimeoutSec |
Maximum wait time per smartctl attempt. |
labels\label-<serial>.png— image of every generated labellogs\tested.csv— semicolon-separated log (opens directly in Excel) with date, model, serial, health, verdict, and so on
- BAD: SMART overall status FAILED, uncorrectable sectors, NVMe critical warning / media errors / spare below threshold, 10 or more reallocated sectors, or less than 10% endurance left.
- CHECK: a few reallocated/pending sectors, or less than 30% endurance left.
- GOOD: none of the above.
- UDMA CRC errors are reported but not counted (usually a cable or dock problem, not a drive problem).
The remaining-endurance percentage is taken, in order of reliability, from
smartctl's endurance_used (computed for recognized drives), the NVMe
percentage_used field, or a known life attribute matched by name — and
only accepted when it is a plausible percentage (0–100). Total bytes
written is normalized from the various vendor attribute conventions (LBAs,
GiB, 32MiB units); internal NAND/flash write counters are ignored.
- Task Manager shows the drive as USB but the tool finds nothing: some USB docks report themselves as SCSI. The tool also checks the Storage layer BusType (what Task Manager uses) and otherwise asks which drives to check. In assembly-line mode every newly plugged-in drive is picked up regardless of bus type.
- "Reading SMART failed": the USB dock does not pass SMART through. Try a different dock/adapter or another USB port. The script already tries several methods (SAT and the ASMedia/JMicron/Realtek NVMe bridges).
- Label comes out of the wrong printer: set the correct
PrinterNameinconfig.json(look it up with-ListPrinters). - Label is rotated or clipped: the tool prefers a paper size the driver
already defines and rotates the design automatically; the chosen paper
size is shown in the console. Check that the label size in the printer
driver matches the loaded roll. If it is still wrong, pin
Rotationinconfig.jsonto"on"or"off"and print another test label. - Installing smartctl manually: download
smartmontools-<version>.win32-setup.exefrom https://github.com/smartmontools/smartmontools/releases and install it; the script finds it inC:\Program Files\smartmontoolsautomatically. Alternatively drop a standalonesmartctl.exeinto thetools\folder. - Security prompt on first start: the script requests administrator rights via UAC; this is required for low-level disk access.