Title: Message

If you’re interested I have similar code which can be dropped into a simple VB.NET form and run that way. I was doing this type of operation routinely enough that I just put the whole thing in a VB.NET app so I could pull it up on the screen for the management whenever they wanted it.

 

r/

Lou

 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brad Hibbert
Sent: Tuesday, February 01, 2005 3:20 PM
To: [email protected]
Subject: RE: [ActiveDir] ADUC Export

 

Here is a simple recursive VB script that can accomplish this

 

strDomain = "DC=ds,dc=nplab,dc=secure"  ‘ Enter your DN here
strOutput = ""
enumerateOUs(strDomain)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set file = fso.CreateTextFile("Result.txt", true)
file.writeLine(strOutput)
file.Close
Function enumerateOUs(strDN)
            Set container = GetObject("LDAP://" + strDN)
            
            strOutput = strOutput & "Current OU" & vbTab & strDN & vbcrlf
            container.Filter = Array("User")
            For each obj in container
                        If obj.class="user" Then
                                    strOutput = strOutput & vbTab & vbTab & vbTab & obj.DistinguishedName & vbcrlf
                        End If
            next
            container.Filter = Array("OrganizationalUnit")
            For each Obj in Container
                        enumerateOUs(obj.distinguishedName)
            Next
End Function

 

Regards

Brad

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rogers, James
Sent: Tuesday, February 01, 2005 7:08 AM
To: [email protected]
Subject: [ActiveDir] ADUC Export

In ADUC 2003, an "Export List" command is available that will export the contents of the immediate OU you're viewing.  Is there a way to export the full tree for an entire domain?  I'd like to pull a list of all OU's, their position in the tree, and their contents.  Is this possible, or just a pipe dream?

 

-James R. Rogers

Reply via email to