The following script gets hard disk status information from Hard Disk Sentinel by WMI function and displays the details.
Thanks to Mitchell K. for the script and example.
#### Code Start $HdInfo = Get-WmiObject -Query "select * from hdsentinel" -Namespace "root\wmi" $Output = @() foreach($Hd in $HdInfo) { $SmartPsObject = @() foreach($Attribute in ($Hd.SMART -split ([char]13))) { if($Attribute -ne '') { $AttArr = $Attribute -split ',' $SmartPsObject += (New-Object PSObject -Property @{ Number = $AttArr[0] Attribute = $AttArr[1] Threshold = $AttArr[2] Value = $AttArr[3] Worst = $AttArr[4] Data = $AttArr[5]}) } } $Properties = Get-Member -InputObject $Hd -Name "__*" | Select -ExpandProperty Name $Hd | Add-Member -MemberType NoteProperty -Name 'SMARTObject' -Value $SmartPsObject $Output += $Hd | Select * -ExcludeProperty $Properties } $Output #### Code End
The following script can be used to receive Pushover notifications when any hard disk drive / SSD triggers an alert in Hard Disk Sentinel Pro.
Thanks for Kevan L. B. for the script and example.
# Pushover API Documentation # https://pushover.net/api # Hard Disk Sentinel Environment Variables # https://www.hdsentinel.com/help/en/26_c_msg.html # Test Values <# $env:HDS_TimeStamp = '20190220 222023' $env:HDS_Host = 'COMPUTER' $env:HDS_Alert = 'Overheat' $env:HDS_Disk = "Disk: #0 Some Disk" $env:HDS_Threshold = 'Temperature threshold setting: 42 C' $env:HDS_Health = 'Some Disk 100%' #> $HDSDateTimeFormat = 'yyyyMMdd HHmmss' $HDSDateTime = ([DateTime]::ParseExact($env:HDS_TimeStamp, $HDSDateTimeFormat, [CultureInfo]::InvariantCulture)) $PushoverApiUri = 'https://api.pushover.net/1/messages.json' $PushoverTimestamp = ([DateTimeOffset]($HDSDateTime.ToUniversalTime())).ToUnixTimeSeconds() $PushoverRequest = @{ token = 'redacted' user = 'redacted' message = "$env:HDS_Disk`n$env:HDS_Threshold`n`nOverall Disk Health:`n$env:HDS_Health" title = "$env:HDS_Host`: $env:HDS_Alert" timestamp = $PushoverTimestamp } Invoke-RestMethod -Method Post -Uri $PushoverApiUri -Body $PushoverRequest
The command configured in Hard Disk Sentinel to produce the alert (specifid at Configuration -> Operations -> Run external application or batch file):
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Unrestricted -File "C:\Scripts\HDSentinelPushoverAlert.ps1"
The Alternative for NET SEND forum topic suggested a method to use Pushover but I just wanted to use PowerShell without the need for curl so that no additional tools were required and so that I had more control over the output.
Here is a screenshot what an alert looks like on the phone using the script and Pushover application registration:
Did you make any scripts, tools, add-ons which may be useful? Please send an e-mail so it can be shared to help other users.