Results 1 to 5 of 5

Thread: Getting a list of pcs on a network

  1. #1

    Thread Starter
    Banned
    Join Date
    Aug 2006
    Posts
    77

    Getting a list of pcs on a network

    Hi,

    How can I get the names of PCs on my network using c#? Any help woud be appreciated?.

    Thanks.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Getting a list of pcs on a network

    There may be another way but I'm not aware of it.

    http://www.planet-source-code.com/vb...=734&lngWId=10
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    Re: Getting a list of pcs on a network

    Two ways jump to mind - WMI or Active Directory (AD stores all computers joined to the domain, of course).

    Apparently this book has a nice section on WMI: http://www.amazon.co.uk/exec/obidos/.../wwwxamlnet-21
    Something to note though - you must have appropriate rights on each PC to query the WMI interface...

    As for AD - the LDAP query would be: "(objectClass=computer)". You will, of course, need a domain controller to connect to, and appropriate rights to query AD.

  4. #4

    Thread Starter
    Banned
    Join Date
    Aug 2006
    Posts
    77

    Re: Getting a list of pcs on a network

    Thanks guys!.

    jmcilhinney, I have managed to implement that code even though I don't really understand it?.. and axion_sa, I was actually looking to use Wmi in other parts of the program but was unaware that I could retrieve PC names using WMI. How is this possible?.

    Thanls.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Getting a list of pcs on a network

    Check out gigemboy's signature for some WMI links. He's wrapped up a lot of WMI classes all into one place. WMI is used through the System.Management namespace. For a list of all available WMI classes and their members go here. It's the Win32 classes that you'll be most interested in. For more information on using WMI in .NET go here.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width