Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writing an application that would go to a UNC to determine the space avaialble, I don't how how to do this, I don't think DriveInfo class would do it because it expects a real drive name. Keeping in mind that mapping that UNC to the local server to a network drive is not an option here. Thanks in advance. Please feel free to be details as I am new in c# and in this subject in particular.
Posted

Personally, I have not done this directly, but this Stack Overflow question has two possible solutions for you:

http://stackoverflow.com/questions/2050343/programmatically-determining-space-available-from-unc-path[^]

The accepted answer might map a path, but I don't think it has to in order to work. The other solution also looks like it could work.
 
Share this answer
 
Comments
Member 8714829 5-Jul-12 18:22pm    
some good progress, thanks for the reply, I get the following error: "The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)"
I think it has to do with permissions or needing to log into this unc first providing user id and password (??)
Tim Corey 5-Jul-12 18:32pm    
That is entirely possible. This is a tricky process, since you are asking to access system-level data on a remote machine. The permissions have to be just right to do so. Can you log in as a domain admin just to test it? If it works, you know that permissions are the issue.
Member 8714829 5-Jul-12 18:48pm    
Not sure if I can log in as Admin. but I personally have access (assigned to my user id) and able to get on that unc, but just to keep you posted, I did attempt to first impersonate the user that is given access to this unc, but still getting the same error. There must be something else or like u say maybe there is a need for admin rights....
Use GetDiskFreeSpaceEx(...) in pInvoke
 
Share this answer
 
I figured that I may have to map the nas network drive then un map it when done (the reason why I came to this conclusion is mostly because the nas may not have a wmi installed on it), so the question now is how do I go about doing that?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900