Enumerating Network Shares

  • Thread starter Thread starter Glenn Leifheit
  • Start date Start date
G

Glenn Leifheit

Does anyone have any sample code on enumerating network shares with vb.net.
I here you need to use wither an API or WMI, or are there other
recomendations.

Thanks

Glenn
 
If you know the drive letters you could use the following API. Otherwise
you would have to use the WNetEnumResource API call.
anand



Private Declare Function WNetGetConnection Lib "mpr.dll" Alias _
"WNetGetConnectionA" _
(ByVal lpszLocalName As String, _
ByVal lpszRemoteName As String, _
ByRef cbRemoteName As Int32) As Int32


Then use the following code to call this API


Dim y As String
y = Space(100)

WNetGetConnection("Y:", y, 100)
MsgBox(y)

Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top