kjacobsen icon

Physical Disks, SMART and PowerShell

kjacobsen | PRO | 04/02/12 10:13:54 AM UTC | 0 ⭐ | 1007 👁️ | Never ⏰ | []
PowerShell |

780 B

|

None

|

0 👍

/

0 👎

# Code Snippet from aperturescience.su
 
#
# SMART Status for physical disks
#
Write-Verbose "Starting physical drive checks..."
$drives = Get-WmiObject win32_diskdrive
foreach ($drive in $drives)
{
    $deviceid = $drive.deviceid
    Write-Verbose "checking $deviceid"
    $model = $drive.model
    $status = $drive.status
    $serial = $drive.serial
    Write-Verbose "$deviceid $status"
    if ($status -ne "OK")
    {
        #drive has some sort of not-ok predictivie failure
        send-email "WARNING: Physical drive $deviceid has a predictive failure status of $status. `n Information for troubleshooting: Drive model: $model, Drive Serial: $serial" $false
    }
    else
    {
        send-email "Physical drive $deviceid is not in a predictive failure state" $true
    }
}
 
# Code Snippet from aperturescience.su

Comments