Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to list network computer name, Ip in C#

how to list network computer name, Ip in C#

Scheduled Pinned Locked Moved C#
helpsysadmincsharpcomwindows-admin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sanjib Raj
    wrote on last edited by
    #1

    i want to list all Computer Name, and Ip Address for the Domin "WLINKTECH". i use the following code but get an error like this, so plz help me about the problem. -------------------- using System; using System.DirectoryServices; namespace IPAddressof_RemoteComputer { public class Class1 { public Class1() { // // TODO: Add constructor logic here // } public void getIpCName() { DirectoryEntry entry = new DirectoryEntry("LDAP://wlinktech"); DirectorySearcher mySearcher = new DirectorySearcher(entry); mySearcher.Filter = ("(objectClass=computer)"); Console.WriteLine("Listing of computers in the Active Directory"); Console.WriteLine("============================================"); foreach(SearchResult resEnt in mySearcher.FindAll()) { Console.WriteLine(resEnt.GetDirectoryEntry().Name.ToString()); } Console.WriteLine("=========== End of Listing ============="); } } } --------------- Error like this ------------------ An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in system.directoryservices.dll Additional information: The server is not operational Sanjit.rajbanshi@wlinktech.com

    M 1 Reply Last reply
    0
    • S Sanjib Raj

      i want to list all Computer Name, and Ip Address for the Domin "WLINKTECH". i use the following code but get an error like this, so plz help me about the problem. -------------------- using System; using System.DirectoryServices; namespace IPAddressof_RemoteComputer { public class Class1 { public Class1() { // // TODO: Add constructor logic here // } public void getIpCName() { DirectoryEntry entry = new DirectoryEntry("LDAP://wlinktech"); DirectorySearcher mySearcher = new DirectorySearcher(entry); mySearcher.Filter = ("(objectClass=computer)"); Console.WriteLine("Listing of computers in the Active Directory"); Console.WriteLine("============================================"); foreach(SearchResult resEnt in mySearcher.FindAll()) { Console.WriteLine(resEnt.GetDirectoryEntry().Name.ToString()); } Console.WriteLine("=========== End of Listing ============="); } } } --------------- Error like this ------------------ An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in system.directoryservices.dll Additional information: The server is not operational Sanjit.rajbanshi@wlinktech.com

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      Hi Sanjit.rajbanshi, I have tested your code in Window Application (C#) after changing my AD name (sync.net). It's working fine. I have no problem with it. maybe. you are getting this error cuz you dont have the permission or you might put wrong AD name. If your application is web application then you need to impersonate ur account.

      Thanks and Regards, Michael Sync Blog: http://michaelsync.net

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups