Active Directory: Find Disable Users Email address



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








.



Relevant Pages

  • Re: regex for PHP variable name
    ... variable name like "$varname" in my script. ... Should do a pattern match for "$" and any not whitespace characters after ... i work on a Content System Manager, atemplate like system, after all my try, a simple get_file_content, replace keywork and finish with evalon php code was unsuccessful and eval set me to "error in eval's code at line 1", why, i can't explain this. ...
    (alt.php)
  • scripting in the active directory
    ... Scenario ... Around 500 users in the active directory with an smtp email address created ... A script which deletes the old email address from every user, ...
    (microsoft.public.windows.server.scripting)
  • scripting in the active directory
    ... Scenario ... Around 500 users in the active directory with an smtp email address created ... A script which deletes the old email address from every user, ...
    (microsoft.public.scripting.vbscript)
  • script and email accounts
    ... Scenario ... Around 500 users in the active directory with an smtp email address created ... A script which deletes the old email address from every user, ...
    (microsoft.public.windows.server.active_directory)
  • Bulk Change of Email Domain
    ... Add the new smtp email address with the new domain ... with a script? ... Mr Huang ...
    (microsoft.public.exchange.admin)