⏳ Attn: DattoCon Miami 🌴 attendees - time is running out to sign up for PreDay experiences and Peer Forums at no additional cost. Follow this link to update your registration > https://web.cvent.com/event/d7d27022-d9c3-4880-8edc-3cbd5ef420b9/register

Detect HDD or SSD plus SMART Health

Sidney Sahdala
Sidney Sahdala Member, Kaseya Certified, Kaseyan, Kaseya Staff

KASEYAN

edited June 20 in Solutions

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.



«1

Comments

  • Sidney Sahdala
    Sidney Sahdala Member, Kaseya Certified, Kaseyan, Kaseya Staff

    KASEYAN

    edited August 2019

    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.

  • DmitrijKondrasov
    DmitrijKondrasov Member, Managed Service Provider
    edited August 2019

    Hello,

    I've got an errors:

    Failed THEN in step 34 (Line 51)

    Failed ELSE in step 2 (Line 60)

    image

    Tried several times.

    Firstly I've created Custom Fields and run procedure. Tried on two computers with SSD disks.

  • Kevin Saunders
    edited September 2019

    I am getting the same errors that Dmitrij is getting.

  • Dale
    Dale Member CHOCOLATE MILK
    edited September 2019

    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.

  • Aaron
    Aaron Member
    edited September 2019

    Some reports say SSD Wear 0

    ANd some say SSD Wear 100

    What gives?

  • Sam James
    Sam James Member
    edited September 2019

    Doesn't run for me - all tests show Failed THEN in step 34 (Line 51)

  • Sam James
    Sam James Member
    edited September 2019

    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

  • Dale
    Dale Member CHOCOLATE MILK
    edited September 2019

    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.

  • Sam James
    Sam James Member
    edited September 2019

    And Dri ve Type I've just noticed

  • Sam James
    Sam James Member
    edited September 2019

    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. 

  • John A Wheeler
    edited October 2019

    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.

  • M
    M Member
    edited October 2019

    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

  • John A Wheeler
    edited October 2019

    That seems to have fixed it.  Thanks

  • Dale
    Dale Member CHOCOLATE MILK
    edited October 2019

    Thank you, M

  • Brian McGarey
    Brian McGarey Member
    edited November 2019

    Does anyone have an idea how to correct the unknown drive type?

  • Sidney Sahdala
    Sidney Sahdala Member, Kaseya Certified, Kaseyan, Kaseya Staff

    KASEYAN

    edited April 2020

    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. 

  • marcb
    marcb Member
    edited April 2020

    Thanks Sidney, I anxiously await your discovery...

  • John Halama
    John Halama Member
    edited August 2020

    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:

  • Gertjan
    Gertjan Member CHOCOLATE MILK
    edited October 2020

    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?

  • Gertjan
    Gertjan Member CHOCOLATE MILK
    edited October 2020

    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!

  • Cas Krist
    Cas Krist Member
    edited February 2021

    Does anyone have the script working (without failed)

  • bigbene
    bigbene Member CHOCOLATE MILK

    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

  • bigbene
    bigbene Member CHOCOLATE MILK

    I cannot import the script. It says "Please pick a script export file or paste a script.".

    Any ideas?

  • Sidney Sahdala
    Sidney Sahdala Member, Kaseya Certified, Kaseyan, Kaseya Staff

    KASEYAN

    @bigbene I thought it should import. If not then please refer to this How to Import Agent Procedures after 9.5.7a – Kaseya

  • Sidney Sahdala
    Sidney Sahdala Member, Kaseya Certified, Kaseyan, Kaseya Staff

    KASEYAN

    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.

  • Sidney Sahdala
    Sidney Sahdala Member, Kaseya Certified, Kaseyan, Kaseya Staff

    KASEYAN

    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

  • tlykken
    tlykken Member, IT Pro CHOCOLATE MILK

    I cannot import the script. It says "Please pick a script export file or paste a script.".

    Any ideas?

    I get this same error.

  • tlykken
    tlykken Member, IT Pro CHOCOLATE MILK

    I cannot import the script. It says "Please pick a script export file or paste a script.".

    Any ideas?

    I get this same error.

  • Sidney Sahdala
    Sidney Sahdala Member, Kaseya Certified, Kaseyan, Kaseya Staff

    KASEYAN

    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

  • Micheal Shank
    Micheal Shank Member CHOCOLATE MILK

    Thank you Sidney, that helps