Kaseya Community

SSD Filter- SQLview not working properly

  • Ok, I did a search but could not find anything like this so...

    I am redoing our Defrag scripts, and want to exclude any machine with a SSD installed. I thought at first it would be very simple, but it has ended up being more complex. Where I am at now is using a 'get variable, SQL view' to look and see if the drive product name starts with SSD (All Intel SSD drives are SSDxxx). However, the issue I am running into is that the script randomly grabs the CD/DVD ROM drive from the database.

    I am using two 'IF' statements, one to look at the DriveType and one for the ProductName. I have tried childing the two IF's into one statement with the same result as above. I did a manual query in SQL, and what I am seeing is that the machines that are pulling the CD/DVD drive have the DriveType 'CD ROM' first and then the 'Hard Disk'.

    So, any thoughts on what I am doing wrong? I have done similar scripts before, and it has always worked. The script should be looking at the database view for 'DriveType=Hard Disk' and IF so then check IF 'DriveProductName begins with SSD' if so write the script entry.

    Any one else have a proven way to filter out SSD drives? Thanks

  • You're not doing anything wrong. There is no industry standard for identifying SSD yet. Some drives don't even have SSD in their names. We are almost forced to build a list manually until these manufacturers figure out what they want to do.

  • Thanks for the reply.

    We are an Intel partner, so only sell their SSD drives which all include SSD in the product name. I don't want to build a list and have to manually update it all the time, which is why I am trying to use the SQLview variable.

    And that is my biggest question, anyone have any ideas on the SQLview grabbing the incorrect data than what I have specified to check?

  • Example.txt

    In that case, I would make a custom view in the database.

    See attached file for example.

    [edited by: SMason at 4:06 PM (GMT -7) on 7-11-2011] Attach file.
  • I guess I will have to. Thanks

  • We created the custom view in the database and have everything working correctly now. I did find out that when using the SQLview variable inside a procedure, only the first row in each column is processed. So for my above script, machines with a CD Rom drive and a Hard Disk in the view reported the CD Rom since obviously "C" comes before "H"

  • This sounds very useful. Any chance you can share how you made this work? Did you actually create that view in the database itself (or a similar one), and how did you query it in the script to see if the product name includes SSD?

  • Procedure Check SSD drive.xml

    this is what we use here

    I use WMIC to do the trick,  indeed only for %SSD% in the device name.

    [edited by: Sloeber70 at 7:13 AM (GMT -7) on 6-28-2012] spelling
  • Test_For_SSD.xml


    Here's perhaps a simpler method ... It uses powershell to query wmi, saving the result in the default variable, then it's a simple if/then whether to defrag or not. The caveat is, of course, that the model name MUST contain SSD