/ Published in: Visual Basic
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
Set oRootDSE = GetObject("LDAP://RootDSE")
Set Conn = CreateObject("ADODB.Connection")
Set Comm = CreateObject("ADODB.Command")
Conn.Provider = "ADsDSOObject"
Conn.Open "Active Directory Provider"
Set Comm.ActiveConnection = Conn
Comm.Properties("Page Size") = 1000
strBase = "<LDAP://" & oRootDSE.get("defaultNamingContext") & ">;"
strFilter = "(&(objectCategory=person)(objectclass=user)(objectCategory=person)(!wwwhomepage=*));"
strAttrs = "givenName,sn;"
strScope = "subtree"
Comm.CommandText = strBase & strFilter & strAttrs & strScope
Set RS = Comm.Execute
If NOT RS.EOF Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:\noids.txt", true)
RS.MoveFirst
MyFile.WriteLine("First Name,Last Name")
Do Until RS.EOF
'WScript.Echo Rs.Fields(0) & "," & RS.Fields(1)
MyFile.WriteLine(Rs.Fields(0) & "," & RS.Fields(1))
RS.MoveNext
Loop
End If
Conn.Close
MyFile.Close
Set oRootDSE = Nothing
Set Conn = Nothing
Set Comm = Nothing
Set User = Nothing
Set fso = Nothing
Comments
 Subscribe to comments
                    Subscribe to comments
                
                