Experts Exchange connects you with the people and services you need so you can get back to work.
Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.
on error Resume Next
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fs, f, ts, s
Set fs = CreateObject("Scripting.FileSystemObject")
File = "d:\expiredateallusers.txt"
Set f = fs.GetFile(File)
Set ts = f.OpenAsTextStream(ForWriting, TristateFalse)
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<GC://dc=DOMAIN,dc=LOCAL>;(&(objectCategory=user)(samaccountname=*))" & _
objCommand.Properties("Page Size") = 1000
Set objRecordSet = objCommand.Execute
intCounter = 0
While Not objRecordset.EOF
'wscript.Echo objRecordSet.Fields("samaccountname") & " - " & objRecordSet.Fields("accountExpires")
ts.writeline objRecordSet.Fields("samaccountname")& ";" & objRecordSet.Fields("name") & ";" & objRecordSet.Fields("accountExpires")
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.