HighTechTalks DotNet Forums  

Get disk and partition numbers for drive letter via WMI

Dotnet Framework (WMI) microsoft.public.dotnet.framework.wmi


Discuss Get disk and partition numbers for drive letter via WMI in the Dotnet Framework (WMI) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Computer Guru
 
Posts: n/a

Default Get disk and partition numbers for drive letter via WMI - 06-28-2007 , 01:52 AM






If I query WMI for mounted drives of type 3 (physical hard drives)
and
end up with a letter (like D, how can I use WMI to get the correct
corresponding partition and drive values for drive D:\ ?

Is it possible to even get the entire ARC path from there?
AS in, multi(w)disk(x)rdisk(y)partition(z)


That would be nice, but I'm willing to settle for just rdisk() and
partition() (basically the drive number and the partition number)


Thanks!


Reply With Quote
  #2  
Old   
Jonathan Liu [MSFT]
 
Posts: n/a

Default Re: Get disk and partition numbers for drive letter via WMI - 08-07-2007 , 05:14 PM






Once you get you physical drive you get it's associating partitions, which
will look like something like this if you have 2 partitions:

WQL Query: associators of {Win32_DiskDrive.DeviceID="\\\\.\\PHYSICALDRIVE0"}

Win32_DiskPartition.DeviceID="Disk #0, Partition #0"
Win32_DiskPartition.DeviceID="Disk #0, Partition #1"

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--
"Computer Guru" <mqudsi (AT) gmail (DOT) com> wrote

Quote:
If I query WMI for mounted drives of type 3 (physical hard drives)
and
end up with a letter (like D, how can I use WMI to get the correct
corresponding partition and drive values for drive D:\ ?

Is it possible to even get the entire ARC path from there?
AS in, multi(w)disk(x)rdisk(y)partition(z)


That would be nice, but I'm willing to settle for just rdisk() and
partition() (basically the drive number and the partition number)


Thanks!



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.