Hard Disk SSD
I would like to create a dynamic label that gives me computers with an SSD hard disk
Answers (2)
This is really complex since Windows does not really report this.
The only clue may be the name of the media. If all media are named correctly a CIR for all SSD, a CIR for all HDD, a CIR for all NVME would be the way to go.
Some CIR like ShellCommandTextReturn(cmd /c wmic diskdrive get model | findstr NVMe) and then a report over these.
I tested it on all physical systems (which all have a NVMe built in) and the naming conventions are terrible Samsung has it in the name at the beginning or at the end, Intel in the mid, so a better one is not really possible. But the name could give you a clue.
And your label could then check for the CIR for HDD etc.
I have a blog written in here that might help.
https://www.itninja.com/blog/view/view-and-report-drive-info-and-health-2-methods
Just use method 1 and the SQL query below as a smart label (you will need to change the Custom Inventory ID (in my case 9266) to yours)
SELECT MACHINE.ID AS TOPIC_ID,
MACHINE.NAME AS SYSTEM_NAME,
CASE
WHEN MACHINE.ID IN (SELECT MACHINE.ID FROM MACHINE LEFT JOIN MACHINE_CUSTOM_INVENTORY MCI ON MCI.ID = MACHINE.ID
WHERE SUBSTRING(MCI.STR_FIELD_VALUE, 1, 300) NOT LIKE "%MEDIATYPE%:%SSD%"
AND SUBSTRING(MCI.STR_FIELD_VALUE, 1, 300) NOT LIKE "%MEDIATYPE%:%Unspecified%"
AND MCI.SOFTWARE_ID = 9266
) THEN 'HDD'
WHEN MACHINE.ID IN (SELECT MACHINE.ID FROM MACHINE LEFT JOIN MACHINE_CUSTOM_INVENTORY MCI ON MCI.ID = MACHINE.ID
WHERE SUBSTRING(MCI.STR_FIELD_VALUE, 1, 300) LIKE "%MEDIATYPE%:%SSD%"
AND SUBSTRING(MCI.STR_FIELD_VALUE, 1, 300) NOT LIKE "%MEDIATYPE%:%Unspecified%"
AND MCI.SOFTWARE_ID = 9266
) THEN 'SSD'
ELSE "Unspecified"
END AS "MEDIA_TYPE",
USER.FULL_NAME AS "NOME",
USER.EMAIL
FROM MACHINE
LEFT JOIN USER
ON MACHINE.USER = USER.USER_NAME
LEFT JOIN MACHINE_CUSTOM_INVENTORY MCI
ON MCI.ID = MACHINE.ID
WHERE MACHINE.ID IN (SELECT MACHINE.ID FROM MACHINE LEFT JOIN MACHINE_CUSTOM_INVENTORY MCI ON MCI.ID = MACHINE.ID
WHERE SUBSTRING(MCI.STR_FIELD_VALUE, 1, 300) LIKE "%MEDIATYPE%:%SSD%"
AND SUBSTRING(MCI.STR_FIELD_VALUE, 1, 300) NOT LIKE "%MEDIATYPE%:%Unspecified%"
AND MCI.SOFTWARE_ID = 9266
)
GROUP BY MACHINE.ID