WMI Associators of DiskDrive Where Result Class is MSStorageDriver

Go To StackoverFlow.com

0

Trying to link DiskDrives found in Win32_DiskDrive with the data in MSStorageDriver_ATAPISmartData.

I've tried the following WQL statement, but it returned nothing each time. (I know that there is relevant data in the MSStorageDrive class)

ASSOCIATORS OF {Win32_DiskDrive.DeviceID=[value]} WHERE RESULTCLASS = MSStorageDriver_ATAPISmartData

Any ideas to match the data up?

2012-04-04 00:21
by CJxD


1

The answer was this:

SELECT * FROM MSStorageDriver_ATAPISmartData WHERE InstanceName='[PNPDeviceID]'

Just make sure to double-escape any backslashses. So if the PNPDeviceID as found in Win32_DiskDrive was

IDE\DISKHITACHI_HDT725050VLA360_________________V56OA7EA\5&276E2DE5&0&1.0.0

what would be returned by getting the value will be

IDE\\DISKHITACHI_HDT725050VLA360_________________V56OA7EA\\5&276E2DE5&0&1.0.0

but what you need to send in the WHERE clause is

IDE\\\\DISKHITACHI_HDT725050VLA360_________________V56OA7EA\\\\5&276E2DE5&0&1.0.0

Silly, isn't it?

Oh, and from what I've gathered, you also need _0 on the end of the Device ID, so all together, you would send:

SELECT * FROM MSStorageDriver_ATAPISmartData WHERE InstanceName='IDE\\\\DISKHITACHI_HDT725050VLA360_________________V56OA7EA\\\\5&276E2DE5&0&1.0.0_0'

2012-04-08 19:59
by CJxD
Ads