Get the workgroup names in LAN

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thiruanand24
    New Member
    • Feb 2008
    • 13

    Get the workgroup names in LAN

    Hi!


    In my application i wrote code to find all systems connected in LAN.But it return some systems only. this is the code

    Dim childEntry As DirectoryEntry
    Dim ParentEntry As New DirectoryEntry( )
    Try
    ParentEntry.Pat h = "WinNT:"
    For Each childEntry In ParentEntry.Chi ldren
    Dim newNode As New TreeNode(childE ntry.Name)
    Select Case childEntry.Sche maClassName
    Case "Domain"
    Dim ParentDomain As New TreeNode(childE ntry.Name)
    TreeView1.Nodes .AddRange(New TreeNode() {ParentDomain})
    Dim SubChildEntry As DirectoryEntry
    Dim SubParentEntry As New DirectoryEntry( )
    SubParentEntry. Path = "WinNT://" & childEntry.Name
    For Each SubChildEntry In SubParentEntry. Children
    Dim newNode1 As New TreeNode(SubChi ldEntry.Name)
    Select Case SubChildEntry.S chemaClassName
    Case "Computer"
    ParentDomain.No des.Add(newNode 1)
    End Select
    Next
    End Select
    Next
    Catch Excep As Exception
    MsgBox("Error While Reading Directories")
    Finally
    ParentEntry = Nothing
    End Try

    In that the
    SubChildEntry.S chemaClassName its return value like "Schema" instead of "Computers" .For this i'm not able to list out all systems in my LAN.

    Can anyone give solution for this .plz

    Regards,
    Anand.M
  • radcaesar
    Recognized Expert Contributor
    • Sep 2006
    • 759

    #2
    Last edited by Plater; Mar 31 '08, 02:07 PM. Reason: linked

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      EDIT:
      That snipit used depricated code. I used the depricated and then tried with recomended code.
      Then I looked up what it was doing and realized it wasn't that usefull.
      It only tells you the addresses assoicated with the hostname you pass in.
      (Which would be JUST your own if you pass in no args)

      Comment

      Working...