I'm looking for a way to populate a ComboBox with a password protected list of network shares

VB.NET 2008 Express. I'm looking for a way to populate a ComboBox with a password protected list of network shares. The folders are  all on a N.A.S. Right now the program simply uses the provided username and password to open either (if the personal share option is selected) the user's personal share, or (if the group share is selected) the selected group share by mapping the x drive to it. The group share is selected from a combobox that is statically populated. This list needs to rather be populated with the above mentioned shares on the NAS.

I tried this:

        Dim sDir As String = "\\172.30.30.30\"
        Dim dDir As New DirectoryInfo(sDir)

        For Each folder As DirectoryInfo In dDir.GetDirectories
            ComboBox1.Items.Add(dDir.Name)
        Next

It gives the error:  The UNC path should be of the form \\server\share.
The shares are in the root of the NAS so i can't provide a share name... just for testing I followed the IP with a share name to see what would happen and it just froze. I'm assuming it's because i didn't provide a user or password. I need to populate the combobox with the share names in the password protected root.

Thanks!
we3kingsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

itsmeandnobodyelseCommented:
If the computers are in a local LAN but not in a domain you can't retrieve the share names simply by reading from root.

I wouldn't make it too difficult. Why not define a known share for each computer which you would use as entry point to retrieve the names of the valid shares for combobox. those entries could be in a text file for example.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
we3kingsAuthor Commented:
Thanks for the input. I already have a static list populating the combobox. I really need to get the list from the root because the folders list is bound to change. Also the NAS is a password protected Samba server. This creates the problem I am having accessing the root.

Maybe this is a 500 point question. I will change points to 500.
0
itsmeandnobodyelseCommented:
You might think of installing a service (or daemon if UNIX) at the server which returns a list of all shares on request. The interface to the client pc's typically would be a socket interface.
0
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

we3kingsAuthor Commented:
Technically this is an SMB NAS not a real Linux SAMBA server so that option is not available on this thing. I'm afraid that the solution will lie in the VB code.  :(
0
we3kingsAuthor Commented:
For the record, the answer offered may have worked if we weren't using this particular configuration of devices, but it won't work on this... Thanks just the same.
0
itsmeandnobodyelseCommented:
I found the following site

    http://my.brandeis.edu/bboard/q-and-a-fetch-msg?msg_id=0000NC

which might give you a clue how to retrieve a list of shares from a Samba server.

If for example you can get the tool smbclient described in the above link for Windows you could get the list programmatically by

   system("smbclient -L //computer_name/  -I 192.168.0.77 > xxx.txt");

and then reading the xxx.txt to retrieve the names.
0
we3kingsAuthor Commented:
Technically there is no solution to this problem. You can't get the list from the smb NAS with a Windows workstation. SMBclient is not present on one. His method was possible but that's not what I want to do. I do like his suggestion: "don't make it too hard" which is what I often do. I resolve to leave the list static, but I will put the list in a text file that anyone may edit so they don't have to get into the code to do so... Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
File Sharing Software

From novice to tech pro — start learning today.