Reputation: 1259
Well now i have an issue which is pointing in the use of "path's" physical and network.
I have a SQL server on a Server machine and i have a desktop machine used as client.
I'm runing from my client machine a stored procedure in order to add a streaming data base.
But also before i run this procedure i run another one which prepare the desired "path", this procedure takes:
myPath="\\Server\SharedFolder\SQL\
in order to run the first procedure i have to turn myPath in each physical name:
myPath="DriveLetter:\Public\WorkFiles\SQL\"
Now my Issue is how i will have the physical path, which is build it on the server and which it's from very difficult (to imposible) to know it?
Basically i need a function which will return me the physical path, which the implementation it's not knowing to me. My developing environment is vb.net 2010
Is there anyone to assist me on this?
Upvotes: 0
Views: 563
Reputation: 11773
Something like this
Dim foo As String = "\\DLINK_NAS\Volume_1"
Dim dirInfo As New IO.DirectoryInfo(foo)
For Each drv As IO.DriveInfo In My.Computer.FileSystem.Drives
If drv.IsReady AndAlso dirInfo.Name = drv.VolumeLabel Then
'match here
End If
Next
Upvotes: 0
Reputation: 139256
You can use the NetShareEnum Windows API for this, passing the server's name as the first parameter, with level 2 or 502. Then you can do a match based on the returned paths.
Of course, you will need special group membership for this (Administrator, Power User, Print Operator, or Server Operator) kind of call to succeed.
Upvotes: 1