In my environment, I have lots of Mount Point Drives (MPD hereafter), to simplify my question, let's say, I have a file whose full name is
d:\data\DBA\Perf\abc.sql
In this case, d:\data is actually an MPD but we do no know just from its face value. (i.e. it can be D:\ drive with a folder called \data\DBA)
How can I find out D:\Data is an MPD out of this file full name with PowerShell?
My environment is Windows 2012 R2 + PowerShell V5.
My initial solution is to find all MP drives (I have 10+ such MPDs, like d:\Log, e:\backup, d:\MP\Backup etc), and then try to loop through all MPDs to find whether an MPD name is contained in the file's full name. If so, I know abc.sql is in an MPD.
I am just wondering whether there is a better solution, something like this How to find the mountpoint a file resides on?. This solution is for Linux, but the key point of this solution is to test each directory contained in the path with os.path.ismount(path).
Can we have a similar solution in windows? Or you gurus may have better solution in Windows?
TIA,
Jeff_yao