Howard Bash
asked on
UNC Information from VB.NET
How can I obtain disk information (total size, free, etc...) given the UNC for a network share using VB.NET?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i don't know if this code will work on a share with the C$ at the end but the code i gave above could be used like this
Dim drive As System.IO.DriveInfo = My.Computer.FileSystem.Get DriveInfo( "\\SomeSha redServer\ C$")
dim freeSpace as long = drive.AvailableFreeSpace
the problom is that drives found by that method usaly reqiure a password to access. i have don't know how visual basic will handle this. but try that code if you get access this way you can read and even write files on that drive not just rad free space. i hope this helps.
Dim drive As System.IO.DriveInfo = My.Computer.FileSystem.Get
dim freeSpace as long = drive.AvailableFreeSpace
the problom is that drives found by that method usaly reqiure a password to access. i have don't know how visual basic will handle this. but try that code if you get access this way you can read and even write files on that drive not just rad free space. i hope this helps.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I saw that you can get the information by letter and that implied that I might be able to get such information if I mapped the UNC path and then passed the letter. For some reason, there appears to be no way to go directly and get the info from the UNC.
I wrote a routine to map and unmap shares, but as you noted, VB Student, I need rights to the shares (uid/pwd) and would need to use these to grant rights to execute the function upon. It works, but that I need to map/unmap to obtain a set of paths seems like a waste of bandwidth.
I wrote a routine to map and unmap shares, but as you noted, VB Student, I need rights to the shares (uid/pwd) and would need to use these to grant rights to execute the function upon. It works, but that I need to map/unmap to obtain a set of paths seems like a waste of bandwidth.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'd like to hang in on the question for another day or so and see if anyone else has another avenue to check.
No you misunderstood.
The letter you assign is a temporary drive letter assigned by the program .
Here is the way it works.
You input a UNC path.The code creates a map with a temporary letter,gets the information of that drive and then disconnects it.So you dont have to map the drive before you run the program
The letter you assign is a temporary drive letter assigned by the program .
Here is the way it works.
You input a UNC path.The code creates a map with a temporary letter,gets the information of that drive and then disconnects it.So you dont have to map the drive before you run the program
ASKER
What I need is a function that will accept a UNC such as \\SomeSharedServer\C$ and return total size, free space, etc.