How to get the names of the availalbe computers on your LAN/Workgr
How to get the names of the availalbe computers on your LAN/Workgr
am 03.01.2008 03:12:01 von Fernik
Hi, I need to get a list of the computers in my WorkGroup LAN, with its names
in a similar way you get the available Drives from a PC with
DriveInfo.GetDrives(). Is there a managed class that provide this, if not,
coudl you provide me some guiadance with unmanaged APIs or wrappers.
--
Fernik
http://www.fernik.com.ar
Re: How to get the names of the availalbe computers on your LAN/Workgr
am 03.01.2008 10:14:38 von nemtsev
Hello Fernik,
use NetServerEnum WinAPI method
The sample and description how to do in from managed code is there http://www.codeproject.com/KB/IP/ListNetworkComputers.aspx
---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
F> Hi, I need to get a list of the computers in my WorkGroup LAN, with
F> its names in a similar way you get the available Drives from a PC
F> with DriveInfo.GetDrives(). Is there a managed class that provide
F> this, if not, coudl you provide me some guiadance with unmanaged APIs
F> or wrappers.
F>
RE: How to get the names of the availalbe computers on your LAN/Workgr
am 03.01.2008 10:24:20 von stcheng
Hi Fernik,
As for looping network resources in local network, there are several means
such as RAW network API, wmi or ADSI:
here are some web threads discussing on this, you can have look to see
whether they help some:
API approach:
#list of computers on local network
http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=299 25
#Using Network Functions in Visual C#.NET (Part II - Group Functions)
http://www.csharphelp.com/archives2/archive440.html
ADSI approach:
#Inventory of Domain Users and Computers Using ADSI
http://www.serverwatch.com/tutorials/article.php/1476791
#List of computers on local network
http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=299 25
WMI:
http://www.siccolo.com/Articles/CodeProject/Build_Local_Netw ork_Browser/Buil
d_Local_Network_Browser.html
http://www.activexperts.com/activmonitor/windowsmanagement/w mi/samples/
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx .
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?RmVybmlr?=
>Subject: How to get the names of the availalbe computers on your LAN/Workgr
>Date: Wed, 2 Jan 2008 18:12:01 -0800
>
>Hi, I need to get a list of the computers in my WorkGroup LAN, with its
names
>in a similar way you get the available Drives from a PC with
>DriveInfo.GetDrives(). Is there a managed class that provide this, if not,
>coudl you provide me some guiadance with unmanaged APIs or wrappers.
>--
>Fernik
>http://www.fernik.com.ar
>
RE: How to get the names of the availalbe computers on your LAN/Wo
am 05.01.2008 01:18:01 von Fernik
Hey Steven,
Thanks for your resourceful post, I did managed to build my own
NetworkBrowser class that enumerates the Domain computers and its shares,
however I have another question. Some shares require credentials in order to
access/enumerate them and they throw an UnauthorizedExcepcion, is there any
way to invoke the OS dialog that Windows Explorer displays when it need to
request credentials for a network resource, if not which APIs
managed/unmanaged are available to perform that impersonation.
--
Fernik
http://www.fernik.com.ar
"Steven Cheng[MSFT]" wrote:
> Hi Fernik,
>
> As for looping network resources in local network, there are several means
> such as RAW network API, wmi or ADSI:
>
> here are some web threads discussing on this, you can have look to see
> whether they help some:
>
> API approach:
>
> #list of computers on local network
> http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=299 25
>
> #Using Network Functions in Visual C#.NET (Part II - Group Functions)
> http://www.csharphelp.com/archives2/archive440.html
>
>
> ADSI approach:
>
> #Inventory of Domain Users and Computers Using ADSI
> http://www.serverwatch.com/tutorials/article.php/1476791
>
> #List of computers on local network
> http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=299 25
>
>
> WMI:
>
> http://www.siccolo.com/Articles/CodeProject/Build_Local_Netw ork_Browser/Buil
> d_Local_Network_Browser.html
>
> http://www.activexperts.com/activmonitor/windowsmanagement/w mi/samples/
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
>
> ==================================================
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
> ications.
>
>
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx .
>
> ==================================================
>
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>
> --------------------
> >From: =?Utf-8?B?RmVybmlr?=
> >Subject: How to get the names of the availalbe computers on your LAN/Workgr
> >Date: Wed, 2 Jan 2008 18:12:01 -0800
> >
> >Hi, I need to get a list of the computers in my WorkGroup LAN, with its
> names
> >in a similar way you get the available Drives from a PC with
> >DriveInfo.GetDrives(). Is there a managed class that provide this, if not,
> >coudl you provide me some guiadance with unmanaged APIs or wrappers.
> >--
> >Fernik
> >http://www.fernik.com.ar
> >
>
>
RE: How to get the names of the availalbe computers on your LAN/Wo
am 07.01.2008 03:37:45 von stcheng
Hi Fernik,
As for the protected network share, I'm afraid popup the login dialog
(interactively) is not quite doable here. The reasonable way is to run your
application(at least the thread) under a proper domain account(the
impersonate as you mentioned). Here is a kb article mentioned how to call
API to enstablish a certain account's logon session and impersonate in
NET( the article is for ASP.NET, but the code in it also fits deskop
application):
#How to implement impersonation in an ASP.NET application
http://support.microsoft.com/kb/306158/en-us
Hope this helps also.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?RmVybmlr?=
>References: <5DBF2872-7571-4E87-AC7E-FD27CEBDAD71@microsoft.com>
>Subject: RE: How to get the names of the availalbe computers on your LAN/Wo
>Date: Fri, 4 Jan 2008 16:18:01 -0800
>
>Hey Steven,
>
>Thanks for your resourceful post, I did managed to build my own
>NetworkBrowser class that enumerates the Domain computers and its shares,
>however I have another question. Some shares require credentials in order
to
>access/enumerate them and they throw an UnauthorizedExcepcion, is there
any
>way to invoke the OS dialog that Windows Explorer displays when it need to
>request credentials for a network resource, if not which APIs
>managed/unmanaged are available to perform that impersonation.
>
>--
>Fernik
>http://www.fernik.com.ar
>
>
>"Steven Cheng[MSFT]" wrote:
>
>> Hi Fernik,
>>
>> As for looping network resources in local network, there are several
means
>> such as RAW network API, wmi or ADSI:
>>
>> here are some web threads discussing on this, you can have look to see
>> whether they help some:
>>
>> API approach:
>>
>> #list of computers on local network
>> http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=299 25
>>
>> #Using Network Functions in Visual C#.NET (Part II - Group Functions)
>> http://www.csharphelp.com/archives2/archive440.html
>>
>>
>> ADSI approach:
>>
>> #Inventory of Domain Users and Computers Using ADSI
>> http://www.serverwatch.com/tutorials/article.php/1476791
>>
>> #List of computers on local network
>> http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=299 25
>>
>>
>> WMI:
>>
>>
http://www.siccolo.com/Articles/CodeProject/Build_Local_Netw ork_Browser/Buil
>> d_Local_Network_Browser.html
>>
>> http://www.activexperts.com/activmonitor/windowsmanagement/w mi/samples/
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>> Microsoft MSDN Online Support Lead
>>
>>
>>
>> ==================================================
>>
>> Get notification to my posts through email? Please refer to
>>
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
>> ications.
>>
>>
>>
>> Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>> where an initial response from the community or a Microsoft Support
>> Engineer within 1 business day is acceptable. Please note that each
follow
>> up response may take approximately 2 business days as the support
>> professional working with you may need further investigation to reach
the
>> most efficient resolution. The offering is not appropriate for
situations
>> that require urgent, real-time or phone-based interactions or complex
>> project analysis and dump analysis issues. Issues of this nature are
best
>> handled working with a dedicated Microsoft Support Engineer by
contacting
>> Microsoft Customer Support Services (CSS) at
>> http://msdn.microsoft.com/subscriptions/support/default.aspx .
>>
>> ==================================================
>>
>>
>> This posting is provided "AS IS" with no warranties, and confers no
rights.
>>
>>
>>
>>
>> --------------------
>> >From: =?Utf-8?B?RmVybmlr?=
>> >Subject: How to get the names of the availalbe computers on your
LAN/Workgr
>> >Date: Wed, 2 Jan 2008 18:12:01 -0800
>> >
>> >Hi, I need to get a list of the computers in my WorkGroup LAN, with its
>> names
>> >in a similar way you get the available Drives from a PC with
>> >DriveInfo.GetDrives(). Is there a managed class that provide this, if
not,
>> >coudl you provide me some guiadance with unmanaged APIs or wrappers.
>> >--
>> >Fernik
>> >http://www.fernik.com.ar
>> >
>>
>>
>