Active Directory: Find Disable Users Email address
- From: Rob <Rob@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 3 Apr 2008 08:03:00 -0700
Hi,
First off let me say my knowledge of scripting is limited however I'm trying
to learn..
I have found a script that lists disabled users' Distinguished Name and I
can output this to a csv file using cscript script.vb > C:\output.csv
On Error Resume Next
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.CommandText = _
"<LDAP://dc=nt4lan,dc=com>;(&(objectCategory=User)" & _
"(userAccountControl:1.2.840.113556.1.4.803:=2));distinguishedName;Subtree"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("distinguishedName").Value
objRecordSet.MoveNext
Loop
I would now like to find out what the SMTP email addresses are for these
users if they have one however I can't get the extra LDAP search working.
I have gone into Exchange 2000 System Manager and created a new address book
with a filter which gives me:
(&(&(& (mailnickname=*) (|
(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) ))))
However I do not know how to add this to the previous script and have the
email address displayed in the output. I have seen other references to
proxyAddress but I've not managed to get the output I require. Can anyone
help?
many thanks
.
- Follow-Ups:
- Re: Active Directory: Find Disable Users Email address
- From: Richard Mueller [MVP]
- RE: Active Directory: Find Disable Users Email address
- From: Rob
- Re: Active Directory: Find Disable Users Email address
- Prev by Date: Re: vbsrcipt
- Next by Date: RE: Active Directory: Find Disable Users Email address
- Previous by thread: Req: URL Monitoring Script
- Next by thread: RE: Active Directory: Find Disable Users Email address
- Index(es):
Relevant Pages
|