Skip to main content

CrystalDiskInfo Audit

Overview

This script serves as the primary auditing automation for the Proactive Disk Health Monitor solution. It downloads and executes the Get-CrystalDiskInfo agnostic script to collect deep S.M.A.R.T. data and physical disk health metrics.

The script performs the following key actions:

  1. Data Collection: Gathers detailed hardware specifications, health statuses, and S.M.A.R.T. attributes for all physical disks. It automatically skips virtual machines.
  2. Custom Field Population: Formats the collected data into HTML tables and updates the device custom fields, including basic disk info, detailed S.M.A.R.T. attributes, and the overall health status summary.
  3. Alert Evaluation: Reads the cPVAL Crystal Disk Alert Mode custom field to determine the alerting behavior. If a drive is in a Caution or Bad state and matches the configured alert mode thresholds, the script generates a comprehensive HTML ticket payload and checks the cPVAL Crystal Disk Alert Required checkbox. If the drive recovers, it clears the alert state.

Sample Run

Note: This script is specifically engineered to operate as the automation within the CrystalDiskInfo - Audit Eligible Devices compound condition. While it can be executed manually for on-demand auditing, its primary design is for scheduled, unattended fleet-wide monitoring.

Image1

Dependencies

Custom Fields

Custom FieldTypeExampleScopeAvailable OptionsEditableDescription
cPVAL Crystal Disk Alert ModeDropdownAlerting With RecommendationOrganization, Location, DeviceDisable, Audit Only, Alerting With Recommendation, Alerting Without Recommendation, Alert for Bad Status Only with Recommendation, Alert for Bad Status Only without RecommendationYesControls the automated alerting behavior and determines if tickets are generated for Bad or Caution drive statuses.
cPVAL Crystal Disk Health StatusTextModelA: Good, ModelB: CautionDeviceN/ANoAuto-populated comma-separated summary of each physical disk health status.
cPVAL Crystal Disk Basic InfoWYSIWYGHTML TableDeviceN/ANoAuto-populated HTML table showing essential specifications for each physical disk.
cPVAL Crystal Disk SMART InfoWYSIWYGHTML TableDeviceN/ANoAuto-populated HTML table of detailed S.M.A.R.T. attributes. Problematic attributes are highlighted in red.
cPVAL Crystal Disk Data Collection TimeText2026-08-06 14:30:00DeviceN/ANoAuto-populated timestamp of the last successful audit run.
cPVAL Crystal Disk Alert RequiredCheckboxCheckedDeviceChecked, UncheckedNoAuto-populated flag indicating whether a disk health alert ticket is required.
cPVAL Crystal Disk Alert ContentWYSIWYGHTML PayloadDeviceN/ANoAuto-populated HTML payload used as the ticket body when an alert is required. Cleared when the drive recovers.

Script Variables

Instead of hardcoding defaults, the script relies on NinjaRMM Script Variables as the ultimate fallback mechanism. You can configure these variables directly in the script settings within NinjaRMM to establish global baseline behaviors without modifying the code-signed script file.

NameTypeExampleDefaultAvailable OptionsDescription
Reallocated SectorInteger5050N/AThreshold for the number of reallocated sectors to mark an HDD as degraded.
SourceString/Text\\fileserver\share\CrystalDiskInfo.zip(blank)N/AOptional custom location (URL, UNC, or local path) for the CrystalDiskInfo ZIP file.
Device Age ThresholdInteger55N/ADevice age in years after which a full device replacement is recommended over a drive-only replacement. Set to 0 to ignore.

Note: Do not attempt to change default values by editing the script file directly. The PowerShell script is code-signed, and modifying the code will break the signature and prevent execution. Always use Script Variables to adjust behaviors.

Automation Setup/Import

Automation Configuration

Output

  • Activity Details: Text output indicating the success of the audit, the detected drive health statuses, and whether an alert payload was generated.
  • Custom Fields: Updates all associated CrystalDiskInfo custom fields on the device record.

Changelog

2026-08-06

  • Initial version of the document