Email Address Already Exists ..... so where the @#@#@#$ is it?? MS Exchange 'I am not very good at introducing my Scripts. Let me try here. 'This is just a mod of my RUS-Helper in response to a NG question that goes like this: 'I'm trying to create a mailbox with address@mycompany.com and it says this email address already exists in the Org. 'I have tried to look for all users email addresses and I could not find this so called existent email address...... 'Well, been there, seen that ;) 'Deji Akomolafe March 4, 2004 'The first thing we do is set the Address that we are looking for myAddy = "theproblemAddress@myemaildomain.whatever" Const ADS_SCOPE_SUBTREE = 2 Const E_ADS_PROPERTY_NOT_FOUND = &H8000500D Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCOmmand.ActiveConnection = objConnection objCommand.CommandText = _ "Select distinguishedName from 'LDAP://MyDomainController.MyDomain.com/DC=MyDomain,DC=com' " _ & "where objectClass='Person' AND objectcategory='User'" objCommand.Properties("Page Size") = 1000 objCommand.Properties("Timeout") = 30 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE objCommand.Properties("Cache Results") = False Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF objUserDN = objRecordSet.Fields("distinguishedName").Value Call GetProxyAddy(objUserDN) objRecordset.MoveNext Loop Set objCOmmand.ActiveConnection = Nothing Set objCommand = Nothing Set objRecordSet = Nothing Set objConnection = Nothing Set objShell = Nothing Sub GetProxyAddy(objUserDN) On Error Resume Next 'Load the other proxy addresses into the property cache Set objCont = GetObject("LDAP://" & objUserDN) 'I could just use GC:// here, but.... objCont.GetInfoEx Array("proxyAddresses"), 0 On Error Resume Next varAddrs = objCont.GetEx("proxyAddresses") 'Now, we are going to loop through each of the email addresses associated with the User in AD For each email in varAddrs 'We are looking for a specific email address If instr(email, myAddy) > 0 Then Wscript.Echo myAddy & " is being used by " & objUserDN End If Next 'Clean up Set objCont = Nothing End Sub ''''''''''''''''''''''''''''''''''' '''''''''' The End '''''''''''''''' '''''''''''''''''''''''''''''''''''