
Scheduling Updates of Safelist Aggregation Data in Active Directory
By scheduling periodic updates to safelist aggregation data, you help make sure that the most up-to-date safelist aggregation data is in Active Directory. As explained in Safelist Aggregation, the update logic is optimized to reduce redundancy: Only safelist collections that have been updated by the user since the last time the Update-Safelist cmdlet was run will be updated.
You can use the AT command in the Exchange Management Shell to schedule regular updates for safelist aggregation. We recommend that you schedule daily updates on each mailbox.
The following code shows an AT command that updates all mailboxes daily at 11:00 P.M. on all the servers by using a batch file that is named SafeList.bat.
at 23:00 /every:M,T,W,Th,F,S,Su cmd /c "D:\SafeList.bat"
The following code shows the contents of the SafeList.bat file:
"d:\Program Files\Microsoft Command Shell\v1.0\Powershell.exe" -psconsolefile "d:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command
"get-mailbox | where {$_.RecipientType -eq [Microsoft.Exchange.Data.Directory.Recipient.RecipientType]::UserMailbox } | update-safelist"
For more information about how to run the AT command, see Microsoft Knowledge Base article 313565, How To Use the AT Command to Schedule Tasks.