KnowDotNet NetRefactor

A Quick Look at Directory Services

Digging through Active Directory

by William Ryan
Print this Article Discuss in Forums

If you aren't familiar with it, Active Directory has more good stuff in it than you can imagine.  If you've every wanted to list all of your Active Directory Resources, you're only 6 lines of code away from doing it!


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        
Dim de As New DirectoryEntry("WinNT://infoprogroup") ' Put the name of your

        Dim computer As DirectoryEntry
        
'   MessageBox.Show(de.SchemaClassName)
        Dim wi As WindowsIdentity = WindowsIdentity.GetCurrent
        
'MessageBox.Show(wi.Name.ToString & " " & wi.IsGuest.ToString)

        For Each computer In de.Children

            ListBox1.Items.Add(computer.Name)
        
Next

End
Sub

Writing Add-Ins for Visual Studio .NET
Writing Add-ins for Visual Studio .NET
by Les Smith
Apress Publishing