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. Visual Basic
  4. Get domains & workgroups-reply plzzzz

Get domains & workgroups-reply plzzzz

Scheduled Pinned Locked Moved Visual Basic
questioncsharpsysadmin
4 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.
  • R Offline
    R Offline
    radhika81
    wrote on last edited by
    #1

    How can i get the domain names & workgroups separately in a network usin vb.net?Plzz replyyyy

    J 1 Reply Last reply
    0
    • R radhika81

      How can i get the domain names & workgroups separately in a network usin vb.net?Plzz replyyyy

      J Offline
      J Offline
      John Kuhn
      wrote on last edited by
      #2

      Look up the System.DirectoryServices namespace on MSDN, and check for examples here on CP for the same thing. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

      R 1 Reply Last reply
      0
      • J John Kuhn

        Look up the System.DirectoryServices namespace on MSDN, and check for examples here on CP for the same thing. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

        R Offline
        R Offline
        radhika81
        wrote on last edited by
        #3

        I used the same class n namespace n passed WinNT: as the query but it lists all the domains n workgroups together.I need those separately.Also I want to get the machines in the workgroup.Whats the query that I should pass.Plzzz replllyyyyy

        J 1 Reply Last reply
        0
        • R radhika81

          I used the same class n namespace n passed WinNT: as the query but it lists all the domains n workgroups together.I need those separately.Also I want to get the machines in the workgroup.Whats the query that I should pass.Plzzz replllyyyyy

          J Offline
          J Offline
          John Kuhn
          wrote on last edited by
          #4

          I think the key is to enumerate the Properties collection of each child node in the collection of DirectoryEntry children. While there may be a more elegant way of doing so, the way that I was able to get a list of users, for example, was to do something like this:

              Dim entry As New DirectoryServices.DirectoryEntry
              For Each child As DirectoryServices.DirectoryEntry In entry.Children
                  Dim propertyValue As Integer = 0
                  Try
                      propertyValue = CType(child.Properties("UserFlags").Value, Integer)
                  Catch ex As Exception
                      ' if it throws an exception, it's not a user item 
                      propertyValue = 0
                  End Try
                  If (propertyValue = 513) Then
                      Console.WriteLine(child.Name)
                  End If
              Next
          

          If you look at the property names in the Properties collection, you should be able to isolate which ones are Domains, which ones are workgroups and which ones are users, etc. I believe there may be a more elegant solution, but I haven't found the best reference for that solution yet. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

          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