D
DBC User
Hi all,
I am in a situation where I need to find the a unc path of a
particular drive or I have a unc path, I need to find the drive.
Either way will work. I do not want to use dllimport to make the win32
api call. So after some research I found out that I could use
ManagementObjects
using (ManagementObjectSearcher DiskSearch =
new ManagementObjectSearcher(new
SelectQuery("Select * from Win32_LogicalDisk")))
{
using (ManagementObjectCollection moDiskCollection
=
DiskSearch.Get())
{
foreach (ManagementObject mo in
moDiskCollection)
{
mo.Dispose();
}
}
}
This works and I was able to find all the drives in the box instead of
going through 'A' thru 'Z', but I did not find the UNC path of these
drives. Does any one know how to go about getting the unc path?
Thanks.
I am in a situation where I need to find the a unc path of a
particular drive or I have a unc path, I need to find the drive.
Either way will work. I do not want to use dllimport to make the win32
api call. So after some research I found out that I could use
ManagementObjects
using (ManagementObjectSearcher DiskSearch =
new ManagementObjectSearcher(new
SelectQuery("Select * from Win32_LogicalDisk")))
{
using (ManagementObjectCollection moDiskCollection
=
DiskSearch.Get())
{
foreach (ManagementObject mo in
moDiskCollection)
{
mo.Dispose();
}
}
}
This works and I was able to find all the drives in the box instead of
going through 'A' thru 'Z', but I did not find the UNC path of these
drives. Does any one know how to go about getting the unc path?
Thanks.