473,320 Members | 1,817 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,320 software developers and data experts.

Enumerating Windows Network Resources

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
7 3137
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Olivier Parisy | last post by:
Hi all, I'd like to get, in a portable way, a list of all network adapters on a local machine running some python code. socket.gethostname() does not seem enough, as it only returns one name...
5
by: JohnFol | last post by:
I am using the Win23 API WNetCancelConnection2 and can sucessfully make a connection to a share within my class. The class is called from a Windows Form based test harness. When I instantiate...
4
by: Brian P. Bailey | last post by:
Hello, I'm trying to enumerate the fixed-pitch font families installed on a system. I am _not_ trying to create a generic monospaced font. I've tried looking at: FontFamily...
7
by: Mullin Yu | last post by:
if i put the same code at the windows application or console, i can logon to the computer. but, if i put the same code at the windows service and start it, i still can't logon to the machine. ...
3
by: Bonj | last post by:
I need to write a windows service, and the only way it can access a shared drive on a file server on the network is if the installer is put in "User" mode - "LocalService", "LocalSystem" and...
8
by: Pete Wittig | last post by:
Hello, I am wondering if it is possible to create a networked application with C# that is seen as a windows user. For example, if Bob logged onto windows and then started the application, any...
2
by: Joseph Geretz | last post by:
I'm having a credentialing problem in my web application. Actually, I don't think this is an IIS security issue, since I'm able to access the page I'm requesting. However, the executing page itself...
3
by: serge calderara | last post by:
Dear all, I clearly underdand the advantage of both type of authentification but is it allowed or possible to set the Authentication mode to Windows and then handle a login form for defined...
4
by: Shayne H | last post by:
What is the best way to enumerate a grouping of strings? The way I have been doing it is: Public Enum PlatformID Unknown Win16 Win32 Win32NT WinCE End Enum
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.