Detect HDD or SSD plus SMART Health

KASEYAN
Product Name: Detect HDD or SSD plus SMART Health
Version: 1.0
Description : This agent procedure detects the type of hard drive the Windows OS is using. Either HDD, SSD, or Virtual. It also gets the health (for HDD and SSD), the SSD Wear and Power on Hours, and any HDD Read Errors.
This script uses PowerShell commands only available to Windows 8 and above including Windows Server 2012 and above. It is important to mention that this script is designed for the C drive but you can edit the script to check other drives. Also, this has not been tested on RAID arrays... Any feedback would be greatly appreciated.
This Agent Procedure requires Custom Fields to be created exactly as they appear in the included Documentation PRIOR to importing the Agent Procedures. Most of the times the Custom Fields will match so you do not have to edit the Agent Procedure. There is a possibility that the import doesn’t detect the Custom Fields and you will have to edit the Agent Procedure.
Instructions :
Before you import the Agent Procedure you should create the five Custom Fields below as String Custom Field Types. It is important to mention again that this script is designed for the C drive but you can edit the script to check other drives. Also, this has not been tested on RAID arrays... Any feedback would be greatly appreciated.
1. Drive Type (C:)
2. Drive Health (C:)
3. SSD Wear (C:)
4. SSD Power no Hours (C:)
5. HDD Read Errors (C:)
You can create Custom Fields in the Audit module by going to:
VSA > Audit > View Individual Data > Machine Summary
Please create the Custom Fields exactly as they appear above and PRIOR to importing the Agent Procedure. Most of the times the Custom Fields will match so you do not have to edit the Agent Procedure. There is a possibility that the import doesn’t detect the Custom Fields and you will have to edit the Agent Procedure.
Comments
-
This Agent Procedure together with the Windows System Stability Index Agent Procedure (https://automationexchange.kaseya.com/products/619) will be very helpful in judging the reliability of a system.
0 -
Hello,
I've got an errors:
Failed THEN in step 34 (Line 51)
Failed ELSE in step 2 (Line 60)
Tried several times.
Firstly I've created Custom Fields and run procedure. Tried on two computers with SSD disks.
0 -
I am getting the same errors that Dmitrij is getting.
0 -
I am also getting the same errors and I have tried on around 15 machines which all have different specs. Not once has it done a successful run.
0 -
Some reports say SSD Wear 0
ANd some say SSD Wear 100
What gives?
0 -
Doesn't run for me - all tests show Failed THEN in step 34 (Line 51)
0 -
Fix for: Failed THEN in step 34 (Line 51) and possibly any others go through and ensure all the CF fields are mapped. There shouldn't be any blanks. Just testing on a failing drive
0 -
It looks like there is a problem with the initial instructions. Number 4 should read SSD Power on Hours (C:) instead of SSD Power no Hours (C:)
This spelling mistake will not allow for the agent procedure to automatically detect the custom field. You can leave it incorrect but then you have to manually edit the agent procedure and manually select the field.
1 -
And Dri ve Type I've just noticed
0 -
Caught quite a few drives with read errors so far so great when you get it going. Also added in the create ticket when it goes above a threshold. Got one SSD with 100 wear but there is a firmware update (Kingston) that apparently makes wear levels more accurate.
0 -
I've noticed a few of the SSD drives have reported back "SSD Power on Hours (C:)" as "ÿþ". Something is off there unless that is expected if it can't pull the data.
Also, Dale is spot on with the spelling error on the CF in question. Change it from no to on and it will function as expected.
0 -
I found that if you modify the text output for the powershell commands, the "ÿþ" problem goes away.
Example From:
(Get-Disk 0 | Get-StorageReliabilityCounter).PowerOnHours >> vAgentConfiguration.agentTempDir#\PowerOnHours.txt
Exampleto:
(Get-Disk 0 | Get-StorageReliabilityCounter).PowerOnHours | Out-File -FilePath #vAgentConfiguration.agentTempDir#\PowerOnHours.txt -encoding ASCII
0 -
That seems to have fixed it. Thanks
0 -
Thank you, M
0 -
Does anyone have an idea how to correct the unknown drive type?
0 -
Thanks for everyone's help here. I will be updating this. I have noticed that some drives do not show and am working on this. I am looking for a solution for the unknown drive issue but I think this may be fixed in later versions of PowerShell. I am trying to stick with PowerShell 5 and if I have to use a newer version I will make another submission to the Automation Exchange specifying the version.
0 -
Thanks Sidney, I anxiously await your discovery...
0 -
I'm testing with changing all instances of:
Get-Disk 0 |to:
Get-Disk | Where-Object {$_.IsBoot -eq 'True'} |Ran into a few systems where disk zero is not C:
0 -
Hi, thanks everyone for you information. I do not get anything with the SSD Power on hours. Ive tried both options, looking at the complete thread i think this should be the command: Get-Disk | Where-Object {$_.IsBoot -eq 'True'} | Get-StorageReliabilityCounter).PowerOnHours | Out-File -FilePath #vAgentConfiguration.agentTempDir#\PowerOnHours.txt -encoding ASCII.
Unfortuanetly i get no data or with the other one i get the "ÿþ" output. Does anyone have an idea on this?0 -
looking into this i understand that not all drives show PowerOnHours unfortunately. If someone has a fix for that i would be happy to know this. Thanks again for the other work!
0 -
Does anyone have the script working (without failed)
0 -
Can anyone tell me, do I need to create the custom fields for every machine I want to have it running or can I somehow create the fields for all machines automatically?
Thanks,
Benedikt
0 -
I cannot import the script. It says "Please pick a script export file or paste a script.".
Any ideas?
2 -
@bigbene I thought it should import. If not then please refer to this How to Import Agent Procedures after 9.5.7a – Kaseya
0 -
You only need to create the custom field once in Audit>View Individual Data>Machine Summary. Once you create the custom field on any endpoint, the rest get it as well.
0 -
Hi everyone,
I am glad there has been so much interest and activity on this. You are all great for helping each other out. My schedule is changing a bit and I am going to have more time to work on this Agent Procedure.
Thanks for some of your help on this, I see a lot of ways to improve this.
As for the wear issue showing zero, I've been researching this, and it looks like not all SSD's support this.
If you just enter this into PowerShell you can see where I am getting this information from.
Get-PhysicalDisk | Get-StorageReliabilityCounter
I am thinking about making a condition that if the wear counter is 0 to just assume its an unsupported feature of the drive and not it as such.
Keep an eye on this, I have one other Automation Exchange submission I have to work on before I can get to this.
Thanks!
Sidney
0 -
I cannot import the script. It says "Please pick a script export file or paste a script.".
Any ideas?
I get this same error.
0 -
I cannot import the script. It says "Please pick a script export file or paste a script.".
Any ideas?
I get this same error.
0 -
Hi everyone,
I am glad there has been so much interest and activity on this. You are all great for helping each other out. My schedule is changing a bit and I am going to have more time to work on this Agent Procedure.
Thanks for some of your help on this, I see a lot of ways to improve this.
As for the wear issue showing zero, I've been researching this, and it looks like not all SSD's support this.
If you just enter this into PowerShell you can see where I am getting this information from.
Get-PhysicalDisk | Get-StorageReliabilityCounter
I am thinking about making a condition that if the wear counter is 0 to just assume its an unsupported feature of the drive and not it as such.
Keep an eye on this, I have one other Automation Exchange submission I have to work on before I can get to this.
Thanks!
Sidney
1 -
Thank you Sidney, that helps
0