views:

46

answers:

1

I'm looking to do some things involving (removable) devices, so I was looking at WMI and other APIs, the 'Devices and Printers' screen and the Safely Remove Hardware popup as I want to have as seamless an experience as possible. Problem however.. is that I can't find any way to get the names as my user 'knows' them in his PC.

Example... I connect an iPod, this shows in both DaP and SRH as 'iPod', which is awesome. In WMI the closest I've been able to find are 'Apple Inc. iPod' and 'Apple iPod USB Device'. Similar stories apply for other hardware like a WD My Book and other such hardware. Where do I find the proper string?

Since I am beginning to doubt whether I'm approaching the bigger picture from the right direction with WMI, a bit more explanation... we do a fair bit with removable hardware around here, 99% disk drives. I thought over hard-coding a loop from A to Z and inspect each drive, but to my knowledge removable volumes do not NEED to be mounted on a letter, but can also be dumped in an empty folder on ntfs. That and my small doubt there might be other (non-drive) hardware that needs 'finalizing' before being unplugged is adding to a small nagging doubt that I might be asking the wrong question alltogether. (editors: if this is too much irrelevant information, feel free to edit this out of the question.)

A: 

You can get this with WMI. This Powershell script does just that, the interesting property being Label:

PS C:\>gwmi -Class Win32_Volume | select Name, Label

Name                                                        Label
----                                                        -----
C:\                                                         Windows 7
D:\                                                         Windows 2008
C:\TEST\                                                    MYUSBKEY
E:\                                                         RECOVERY

As you can see, it also works with devices not mounted with a letter.

Marcanpilami
Those are the volume labels, which I don't have any issues with finding. I am referring to the device types. See this popup: http://img44.imageshack.us/img44/6735/removabledevicespopup.pngI am looking for the name right behind the 'Eject' bit. All names I can find have brand names and/or typenumbers in them. Thanks. :)
Stigma