1825719 Members
2946 Online
109686 Solutions
New Discussion

WMI question

 
Adam Garsha
Valued Contributor

WMI question

RE: WMI, Win32_Volume, Win32_DiskPartition and finding which goes with which

With Windows2003 Server, how can I determine which Win32_DiskPartition(s) a Win32_Volume is made from/contains?

Motivation: Automating SAN documenation

=> Win32_DiskDrive,Win32_DiskPartition give me WWID and Basic disk capacity

=> Win32_Volume gives me mount point and freespace/capacity of a filesystem

... How can I link these together? I just need the link/key... not really needing the code.

I want to be able to say "volume{...}" lives on "disk #__, partition #__"

Assume:

(1) My volumes-of-interest are not found as Win32_LogicalDisk(s) instances!; i.e. the volumes are mounted at non-root locations like M:\some\path\here vs. just being "M:\".

(2) We only use basic disks (no dynamic disks), so 1 partition => 1 volume. (But this shouldn't matter if you can find somewhere in WMI that allows linking volumes to their partitions... I can figure out the rest).

#--------------------------------

Before you answer "use Win32_LogicalDisks, Win32_LogicalDiskToParition, please see #1", here is more information to prevent this incorrect answer:

If I query all the Win32_LogicalDisk(s), I only see an instance when a partition is associated with the root drive (e.g. M:)... but not when I have volumes mounted on sub-trees (i.e. UNIX style); e.g.

M:\ <= one volume is mounted here (this partition has a Win32_LogicalDisk)
M:\foo\bar <= another volume mounted to this point in the tree (this partition does not have a Win32_LogicalDisk)
M:\foo\dar <= another volume (living on a disk partition, e.g. )
....

Each volume wraps around one basic disk partition. In otherwords, it is true that I can get everything I need when all my partitions are mapped to drives (D:,E:,...,etc) via Win32_LogicalDisk, however, __IF__ my volumes are __NOT__ mapped to drives and instead are mounted to subtrees then Win32_LogicalDisk instances do not seem to exist (for the volumes in question).

#--------------------------------

I am talking about local basic disks this discussion has nothing to do with network mapped drives.

#--------------------------------

Win32_MountPoint doesn't add anything that I don't already know from Win32_Volume. i.e. I am trying to link the volume to the physical partition (disk #X, paritition #Y), I already know the mount location (Z:\some\path).