Hi,
How can I get the names of PCs on my network using c#? Any help woud be appreciated?.
Thanks.
Printable View
Hi,
How can I get the names of PCs on my network using c#? Any help woud be appreciated?.
Thanks.
There may be another way but I'm not aware of it.
http://www.planet-source-code.com/vb...=734&lngWId=10
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.
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.
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.