Afficher un message
Vieux 02/10/2007, 16h29   #1
Simon G
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut list all users created today

Hello all.

I have an ou in which all new users are created. I currently have a script
which will list all the members of the ou and some of their attributes.

What i want to do is to be able to list this, but only for users who have
been created today.

Here is the script i am currently using - how can i include the "where user
was created today" statement?

on error resume next

Const ADS_SCOPE_SUBTREE = 2

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objNewFile = objFS.CreateTextFile("newstarters.csv")

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

objCommand.CommandText = _
"SELECT ADsPath FROM 'LDAP://ou=new starters,,DC=domain,DC=com' WHERE " _
& "objectCategory='user'"
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst
objnewfile.writeline "samaccountname" & "," & "givenname" & "," & "sn" & ","
& "description"
Do Until objRecordSet.EOF
strPath = objRecordSet.Fields("ADsPath").Value
Set objuser = GetObject(strPath)

objNewFile.WriteLine objuser.samaccountname & "," & objuser.givenname & ","
& objuser.sn & "," & objuser.description
objRecordSet.MoveNext
Loop
  Réponse avec citation
 
Page generated in 0,04645 seconds with 9 queries