How to get Drive Letter Using WMI
Posted
by new
on Stack Overflow
See other posts from Stack Overflow
or by new
Published on 2010-06-11T09:39:54Z
Indexed on
2010/06/11
11:12 UTC
Read the original article
Hit count: 245
i get the vid and pid of the usb devices plugged into my system using WMI.
Now i want to get the drive letter corresponding to the device vid and pid i retrievd.
code
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_USBControllerDevice"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
if (FAILED(pclsObj->Get(L"Dependent", 0, &vtProp, 0, 0)))
{
cout<<"The specified property is not found."<<endl;
}
else
{
wcout <<vtProp.bstrVal << endl;
}
i get like below
\NJ96\root\cimv2:Win32_PnPEntity.DeviceID="USB\VID_1A8D&PID_1000\35809402 0874450"
how can i map DRIVE LETTER to my above output using the WMI
please help me out
© Stack Overflow or respective owner