473,395 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to list shared folder of a network computer.

Hello,
I'm trying to get the list of shared folders of a network computer and add them to a combo box. I'm using the bellow code in VB .NET.

Code
====
Private Sub EnumShares(ByVal Machine As String)
'Local Shares
Try
Dim scope As String = ("\\" & Machine & "\root\cimv2")
Dim SharesClass As ManagementClass = New ManagementClass(scope, "Win32_Share", Nothing)
Dim Shares As System.Management.ManagementObjectCollection = SharesClass.GetInstances()
Dim Share As System.Management.ManagementObject

For Each Share In Shares
MessageBox.Show("Description: " & Share("Description"))
MessageBox.Show("Name: " & Share("Name"))
MessageBox.Show("Path: " & Share("Path"))
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
====================

However, this only seems to work to list shared folders of my own computer. It does not list the folders of other network computers I do have access to when I use MS windows Explorer tool and click on My Network Places / Entire Network / Microsoft Windows Network.
When I call the method as follows EnumShares("\\MyComputerName") it works fine. However when I call it EnumShares("\\OtherComputer") I get the following error:

And unhandled exception fo type
'System.Management.ManagementException' ocurred in
system.management.dll

Additional information: Access denied



Like I said I do have access to these other computer's shared folders.

Thank you.
Oct 13 '06 #1
0 4387

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Daniel | last post by:
when i use stream writer to write to a shared folder, and the network card of that remote computer is disabled in the middle of the write then reenabled later. every time i try to write to that...
3
by: sva | last post by:
Using C# for an application in which I am working on, I need to display the available shared folders on the computer that's running the application. The shared folder paths need to be in UNC format...
10
by: Lloyd Dupont | last post by:
I have written a .NET application which does heavy use of interop (through ManagedC++). It works allright. Now someone askedme if it works when installed in a shared directory. So I'm testing,...
1
by: lecnac | last post by:
Here's some details: Server and workstation both in the same workgroup Logged into server as local Administrator Logged into workstation as a local user that is only in the Users group The...
1
by: lecnac | last post by:
Sorry for the repost. I must have done something wrong when I tried to post my reply (I can't seem to find it). Anyway, I'd really appreciate any help that anyone could provide. My issue is...
13
by: Elton Cohen | last post by:
Hi newsgroup! Can anyone tell me where I should put a simple Access database file in order to be accessible for every computer in the network (same workgroup)? There does not need to be any...
2
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data...
1
by: charlieruss | last post by:
Hello, My problem is as follows: I am using IIS 5.1 with .net 1.1 I have a shared folder on a different computer on our network which I want to add as a virtual directory on my computer so that...
3
by: Paul Brady | last post by:
I have two users, Andrew and Nancy, who each have their own computer and can connect to a common database called "employees.mdb" which resides on a network server. On that same network server,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.