Question : Audit email redirection in AD.

I am administering a fairly complex site, with a few hundred users. Running Exchange 2003 & Server 2003.  A number of users on the site have their email redirected to a contact, so it is forwarded outside of the enterprise. I have been asked to produce a list of all email redirections.  Any ideas on how to do this without going through each user one at a time?

Answer : Audit email redirection in AD.

Hi,

This script might work for you. I've used this before to list all the users in the domain who have an alternate recipient set in AD. Save the file as a vbs file edit the domain and org (i.e. "org>;" ) for your details and run cscript scrtipname.vbs from the command prompt with an account that has permissions to read AD.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
Const ForWriting = 2 ' creats a constant for writing to file
Const Forappending = 8 ' creates a constant for appending to file
 
OutputFile = "InventoryUsers.csv"	' Output file with server details
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Set objInputFile = objFSO.OpenTextFile(InputFile,1,FALSE) ' opens text file object
Set objOutputFile = objFSO.OpenTextFile(OutputFile, forWriting, True) ' opens output file for writing
 
objOutputFile.WriteLine "Account name" & "," & "Alternate Recipient"
 
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
 
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
 
objCommand.CommandText = _
 ";" & _
 "(&(objectCategory=person)(objectClass=user));" & _
 "ADsPath;subtree"
 
Set objRecordSet = objCommand.Execute
 
While Not objRecordset.EOF
 strADsPath = objRecordset.Fields("ADsPath")
 Set objUser = GetObject(strADsPath)
WScript.Echo "Processing ....." & vbtab & objUser.samAccountName 
objOutputFile.WriteLine objUser.samAccountName & "," & objUser.altRecipient
 objRecordset.MoveNext
Wend
 
Wscript.Echo objRecordSet.RecordCount & " Users Checked"
 
objConnection.Close
Open in New Window Select All
Random Solutions  
 
programming4us programming4us