I have an Exchange server with lots of mountpoints. Given the path to the database files is there a way to find out what volume they are on? The problem is that they are typically not at the volume mount point, but further down the tree. I'm using Powershell, so I need a solution preferably using WMI but could also use any .NET or COM objects.
I'd just discovered the ReparsePoint attribute.
After grabbing the directory I'm in, I can walk up the tree untill I get to Root and check for ReparsePoints along the way.
$dbDir = (get-item (Get-MailboxDatabase $db).edbfilepath).directory
$dbDir
if($dbdir.parent){
#todo make this recursive
}
#test if it's a reparse point.
if ($dbdir.attributes -band [System.IO.FileAttributes]::ReparsePoint ){
#it's a mountpoint.
}
From here there's the "mountvol /L" tool, or better the WMI Association class Win32_MountPoint
and Win32_Volume
.
A bit involved- but I don't see a simple way to just ask "what volume am I on?" Once I get it all put together, I'll post a full explanation.
edit - more details here: http://slipsec.com/blog/?p=126