Work out a Drive path/letter

BStar86
01-13-2008, 06:10 AM
Hello all,

Im tryin to work out the assigned letter to a drive,

For instance, i have a samsung 500gb hard drive with the hardware id
*hd501lj* and i want to search for that and then return what letter the hard drive in under, eg F: drive.

I have been trying to do it through a devcon command lines but with no luck.

Cheers BStar

mkaras
01-13-2008, 08:27 AM
Use the My Computer ICON. Right click and select Manage. In the dialog that opens then click on Disk Management which will show you the various disk drives and their properties.

mkaras
01-13-2008, 08:43 AM
An alternative to the above is to open the Device Manager. You can get to this by several methods. One way is to right click on My Computer and select Properties. Within the Hardware tab of the Properties dialog there is a button named Device Manager which you would click.

Another way is to put a shortcut on your desktop called DEVMAN and have its Target value on the short cut properties box be set to %SystemRoot%\system32\devmgmt.msc /s

When Device Manager is open click on "Disk drives" in the device list. This will show the list of physical drives by name. Select the desired drive, right click and select Properties in the popup.

From the drive properties box select the Volumes tab and click the Populate button on that tab. This will generate a listing of all the logical drive letter volumes on that physical drive.

BStar86
01-13-2008, 08:59 AM
Is there a way to do it in visual basic though? I can retrieve the hardware ID in visual basic but after that im stuck!

mkaras
01-13-2008, 11:50 AM
Ahhhh, you didn't mention the desired VB aspect of this before.

I'm sure it is possible but right off the top of my head I suspect that the process would work a little opposite from what you want directly and most likely involves API functions. When I say opposite I mean that you probably would have to scan drive letters and fetch extended information about each to drill it down to which one has the particular attribute you are looking for.

Keep in mind that one physical drive may represent multiple drive letters.

loquin
01-14-2008, 10:24 AM
...Keep in mind that one physical drive may represent multiple drive letters.In other words, it is possible to map multiple logical drive letters to the same physical drive...

Hugh Lerwill
01-15-2008, 03:24 PM
There is an API to determine the UNC path given a mapped drive letter (WNetGetConnection) but not one to determine the mapped drive letter for a given UNC path.

To overcome that I guess you would have to test each drive letter A: thru Z: on the host machine to see if its UNC path coincided with or included the UNC path being specified.

dilettante
01-15-2008, 05:02 PM
"Drive letters" map to volumes or shares, not really to drives. A partitioned drive has multiple volumes.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum