Software Defined Space Available Through UNC Path

Is there a software API for determining free space on NAS storage from a UNC path? I looked at the WMI documentation and it was not clear that this was possible.

A sample code and links to the corresponding API calls would be very helpful.

+5
winapi wmi
Jan 12 '10 at 16:11
source share
2 answers

Using this example on how to get the UNC path, you can simply return the FreeSpace property, I changed the code below:

ManagementPath path = new ManagementPath(@"\" + System.Environment.MachineName + @"\root\cimv2"); ObjectQuery query = new ObjectQuery("select * from Win32_LogicalDisk WHERE DriveType = 4"); ManagementScope scope = new ManagementScope(path, new ConnectionOptions()); ManagementObjectSearcher search = new ManagementObjectSearcher(scope, query); foreach (ManagementObject o in search.Get()) { Console.WriteLine(o.Properties["FreeSpace"].Value.ToString()); } 
-2
Jan 12
source share

The GetFreeDiskSpaceEx Windows API apparently uses a method that works on UNC paths according to MSDN docs .

+4
Jan 12 '10 at 16:25
source share



All Articles