On Error Resume Next
Const ADS_SCOPE_SUBTREE = 2
dtmCreationDate1 = "20070701000000.0Z"
dtmCreationDate2 = "20070731000000.0Z"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT Name, whenCreated FROM 'LDAP://dc=fabrikam,dc=com' WHERE " &_
"objectClass='user' " & _
"AND whenCreated>='" & dtmCreationDate1 & "' AND whenCreated<='" &_
dtmCreationDate2 & "'"
Set objRecordSet = objCommand.Execute
Const ADS_SCOPE_SUBTREE = 2
dtmCreationDate1 = "20070701000000.0Z"
dtmCreationDate2 = "20070731000000.0Z"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT Name, whenCreated FROM 'LDAP://dc=fabrikam,dc=com' WHERE " &_
"objectClass='user' " & _
"AND whenCreated>='" & dtmCreationDate1 & "' AND whenCreated<='" &_
dtmCreationDate2 & "'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("Name").Value, &_
objRecordSet.Fields("whenCreated").Value
objRecordSet.MoveNext
Loop
시작일자는 dtmCreationDate1 이고, 종료일자는 dtmCreationDate2 입니다.
숫자값은 년월일자 이며 일자다음에 숫자는 2단위 시,분,초입니다. 마지막 .0Z 는 로컬시간과 그리니치 시간차를 표시합니다.^^
03-TechNetB_masthead_ltr.gif
댓글 없음:
댓글 쓰기