By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,638 Members | 1,983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,638 IT Pros & Developers. It's quick & easy.

Enumerating Windows Network Resources

P: n/a
I am trying to implement a crawler in C# that scans all
the shared folders in remote computers in a windows
network. Are there classes in .NET to do this directly?
Please help.

Thank You.
Rohan
Nov 15 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Rohan,

Your best bet would be to use the classes in the System.Management namespace, as they wrap access to the Windows Management Interface (WMI). This will give you access to most of the information about machines in a consistent, abstract manner. Once you know how to use these classes, you will want to search for instances of the Win32_Share WMI class on the machine to see what is shared.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- nick(d0t)paldino=At-exisconsulting'dot|com

On Mon, 6 Oct 2003 03:30:41 -0700, Rohan Ranade <ro**********@yahoo.com> wrote:
I am trying to implement a crawler in C# that scans all
the shared folders in remote computers in a windows
network. Are there classes in .NET to do this directly?
Please help.

Thank You.
Rohan

Nov 15 '05 #2

P: n/a
Nicholas, Rohan

Just a small remark, like Nicholas has said WMI is the way to go, however there's a little issue which is security related.
Using windows, whenever you want to access remote resources, you need to have access rights to the computers exposing these
resources.
The same applies to WMI, when you need to query remote WMI services, you'll need to have appropriate access rights to do so. Per
default the WMI service is only accessible from the local system, so you will need to give explicit remote access rights for a
specific user on every system you want to query through WMI.

Willy.

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message
news:op**************@msnews.microsoft.com...
Rohan,

Your best bet would be to use the classes in the System.Management namespace, as they wrap access to the Windows Management Interface (WMI). This will give you access to most of the information about machines in a consistent, abstract manner. Once you
know how to use these classes, you will want to search for instances of the Win32_Share WMI class on the machine to see what is
shared.
Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- nick(d0t)paldino=At-exisconsulting'dot|com

On Mon, 6 Oct 2003 03:30:41 -0700, Rohan Ranade <ro**********@yahoo.com> wrote:
I am trying to implement a crawler in C# that scans all
the shared folders in remote computers in a windows
network. Are there classes in .NET to do this directly?
Please help.

Thank You.
Rohan


Nov 15 '05 #3

P: n/a
Willy is right, unfortunately. I have exactly this problem.
I need to make a list of shared folders for each particular computer in
a domain. But I have to be logged on as a ordinary user. Then every time
I get "Acces denied".
What other means could I use to make the described list?
(using C# classes, not API) Is it possible through Active directory?

Thx in advance

stej
Nicholas, Rohan

Just a small remark, like Nicholas has said WMI is the way to go,
however there's a little issue which is security related.
Using windows, whenever you want to access remote resources, you need to
have access rights to the computers exposing these
resources.
The same applies to WMI, when you need to query remote WMI services,
you'll need to have appropriate access rights to do so. Per
default the WMI service is only accessible from the local system, so you
will need to give explicit remote access rights for a
specific user on every system you want to query through WMI.

Willy.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #4

P: n/a
When running in a Domain, be it an NT or AD you could assign such privilege
to the "Domain users" group.

Willy.

"pepa stefan" <ce*********@seznam.cz> wrote in message
news:uM**************@TK2MSFTNGP11.phx.gbl...
Willy is right, unfortunately. I have exactly this problem.
I need to make a list of shared folders for each particular computer in
a domain. But I have to be logged on as a ordinary user. Then every time
I get "Acces denied".
What other means could I use to make the described list?
(using C# classes, not API) Is it possible through Active directory?

Thx in advance

stej
Nicholas, Rohan

Just a small remark, like Nicholas has said WMI is the way to go,
however there's a little issue which is security related.
Using windows, whenever you want to access remote resources, you need to
have access rights to the computers exposing these
resources.
The same applies to WMI, when you need to query remote WMI services,
you'll need to have appropriate access rights to do so. Per
default the WMI service is only accessible from the local system, so you
will need to give explicit remote access rights for a
specific user on every system you want to query through WMI.

Willy.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #5

P: n/a
Willy, what privilege do you mean?

I'll describe my steps and reasons why I almost gave in.

The first thing I have seen is to set
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Lsa to 0
(the same: in Administrative tools folder go to Local security policy
console
browse to: security settings->local policies->security options ->
doubleclick on Network Access: Sharing and Security Model for local
account
and change it to Classis (from Guest only)

That causes that my connection will not be authenticated as Guest user,
but it will use my account (I hope).

But that didn't work.

Next step: Start --> Run --> wmimgmt.msc
right click WMI control and click Properties.
Click Security tab.
In this window I can set for each namespace a security setting. By
default there are listed two accounts (after click on Security button):
1) Admin - he has full rights for everything
2) Everyone - only limited rights and --
"Everyone" doesn't have enabled Remote Access (Remote Enable)

And because I (in this case) belong to Everyone group, I cann't connect.

I'm not allowed to set this option to enabled on each particular
computer I need to connect to (and it would be crazy).

That's all I know about the problem so far, so I don't understand what
privileges ("to the Domain users") you are talking about.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #6

P: n/a
Next step: Start --> Run --> wmimgmt.msc *** This is exactly what I'm talking about, right click WMI control and click Properties.
Click Security tab.
In this window I can set for each namespace a security setting. By
default there are listed two accounts (after click on Security button):
1) Admin - he has full rights for everything
2) Everyone - only limited rights and --
"Everyone" doesn't have enabled Remote Access (Remote Enable)
And because I (in this case) belong to Everyone group, I cann't connect.

*** That's a good thing. You don't want everyone to take control over your
PC isn't it?
I'm not allowed to set this option to enabled on each particular
computer I need to connect to (and it would be crazy).


*** You don't have to give everyone remote access, you need to add "domain
users" or "domain accounts" or whatever group /account to the list with
appropriate privileges to the wanted namespace. Say for instance "remote
access" and "partial write" to "domain users", "execute methods", "remote
access" and "full write" to "domain accounts".
If you are not allowed to do this you can't use WMI to control other
machines on the network, point.

Willy.

Nov 16 '05 #7

P: n/a
Thx very much, that's what I have been looking for, but haven't been
able to found..

stej

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.