I was attempting to get disk info of remote machines, including whether or not SMART is enabled on the drive by using the win32_diskdrive class.
This is trickier than I thought. While it's easy enough the read the status property I discovered something interesting in the Capabilities property- namely the value denoting if "SMART Notification" is available. This value will not appear unless the command is run in an elevated security context. So for example if I run (gwmi win32_diskdrive).Capabilities the SMART value (10) does not appear in the array of values yet if I run it in an elevated prompt it does appear. As far as I know you can't run a winrm session in an elevated context (and I'm not interested in cheesy schtasks hacks or psexec).
So then I attempted to map win32_diskdrive to the MSStorageDriver_FailurePredictStatus class. I think I would have to do this anyway because even if SMART appears in the Capabilities property that doesn't necessarily mean its enabled right?
I was mapping the PNPDeviceID property of win32_diskdrive to the InstanceName property of MSStorageDriver_FailurePredictStatus, but now my problem is that I do not think the InstanceName property is unique enough for this to work. For example here is my InstanceName: IDE\DiskST3250312AS_____________________________JC47____\5&350bf0c3&0&0.0.0_0
It shows the interface type (IDE) the model number (ST3250312AS) the firmware version (JC47) what I thought was a unique identifier of some kind (5&350bf0c3&0&0.0.0
) then what looks like an index number (_0). When I google 5&350bf0c3&0&0.0.0
it turns up some info on the drive so I don't think this number is unique. That means the the uniqueness is in the index number which is not included in the PNPDeviceID property of the win32_diskdrive class. This is an issue because many of our servers have multiple, identical, disks.
My concern is that MSStorageDriver_FailurePredictStatus
would represent multiple disks like this:
IDE\DiskST3250312AS_____________________________JC47____\5&350bf0c3&0&0.0.0_0
IDE\DiskST3250312AS_____________________________JC47____\5&350bf0c3&0&0.0.0_1
IDE\DiskST3250312AS_____________________________JC47____\5&350bf0c3&0&0.0.0_2
And the PNPDeviceID property of win32_diskdrive of all of them would just be
IDE\DiskST3250312AS_____________________________JC47____\5&350bf0c3&0&0.0.0
How can I reliably map objects retrieved from win32_diskdrive to MSStorageDriver_FailurePredictStatus
or do this another way with powershell via remote sessions?
Edit:
Well it looks like I was over-reacting. When I checked a bunch of servers I found InstanceNames\PNPDeviceIDs like this:
SCSI\Disk&Ven_TOSHIBA&Prod_MBF2600RC\5&354ecb35&0&000200_0
SCSI\Disk&Ven_TOSHIBA&Prod_MBF2600RC\5&354ecb35&0&000300_0
If no one can conclusively confirm this, in a day or so, I will just assume this value actually is unique and mark this as the "answer".
"When the road before you splits in two, take a third path..." ~ Telaxian Proverb
Script
This is the script I used to get the SMART data from multiple machines. I've already enabled
winrm
on the devices used in this example.That will get you output like:
Script Notes: In the text file I have one hostname listed per line. There are no comma's separating the data. Also, computers which don't have smart enabled drives won't show on the report. You can customize the report with more data options to select, just run a
Select *
instead of the options I used in the script to see the full dump.Win32_diskdrive vs MSStorageDriver_FailurePredictStatus
On the question of
win32_diskdrive
vsMSStorageDriver_FailurePredictStatus
properties... TheMSStorageDriver_FailurePredictStatus
is in the dynasty ofMSStorageDriver
in theroot\wmi
namespace (which is separate and distinct fromroot\cimv2
where the classwin32_diskdrve
exists) and get's it's non class specific properties from inheritance. TheMSStorageDriver
gets it's data direct from the hardware (no provider). Where aswin32_diskdrive
has it's ownPNPDeviceID
property which uses the providerWin32_DiskDrivePhysicalMedia
. Both query the same data from the hardware but do so separately.That script above where it gets the
InstanceName
is the same asPNPDeviceID
below:Conclusion
Get's the same data as:
Comment References
This section contains links intended to reference additional information from the comment section of this answer.
Device Tree
Instance IDs
If you connect to the remote WMI namespace using a domain account that is a member of the remote computer's local administrator group, UAC token filtering shouldn't take effect.
When I say connect, I mean by specifying the -computer parameter for Get-WMIObject (sorry, not a fan of aliases - I'm a big fan over readability and maintainability!).