Active Directory 'I am not very good at introducing my Scripts. Let me try here. 'This is a script that loop thru AD and LIST ALL mail-enabled object. 'I put this together from my RUS-Helper in response to a NG question 'May 4, 2004 -Deji Akomolafe Const ADS_SCOPE_SUBTREE = 2 Const E_ADS_PROPERTY_NOT_FOUND = &H8000500D Set objShell = CreateObject("Wscript.Shell") Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCOmmand.ActiveConnection = objConnection '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''Search for Users ''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''We use this to limit our searches to User accounts only 'uncomment all the lines below objCommand.CommandText = _ "Select cn, distinguishedName from 'LDAP://OU=MyOU,DC=myDomain,DC=com'" 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 objUserCName = objRecordSet.Fields("cn").Value Call GetProxyAddy(objUserDN,objUserCName) objRecordset.MoveNext Loop Set objCOmmand.ActiveConnection = Nothing Set objCommand = Nothing Set objRecordSet = Nothing Set objConnection = Nothing Set objShell = Nothing ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub GetProxyAddy(objUserDN,objUserCName) On Error Resume Next 'Load the proxy addresses into an array Set objCont = GetObject("LDAP://" & objUserDN) objCont.GetInfoEx Array("proxyAddresses"), 0 'Clear out any error Err = 0 varAddrs = objCont.GetEx("proxyAddresses") 'If there is no Proxy address, then ignore any error and continue with the next guy If Err = E_ADS_PROPERTY_NOT_FOUND Then Else 'Let's write out anyone that has a proxy Addy. Must be mail-enabled to have one Wscript.Echo objUserCName End If 'Clean up Set objCont = Nothing End Sub ''''''''''''''''''''''''''''''''''' '''''''''' The End '''''''''''''''' '''''''''''''''''''''''''''''''''''