When we upgraded to ARS 6.7 from 6.5, we were just starting to roll out Exchange 2010, so ARS is still set up to create Exchange 2003-style mail-enabled groups. This is fine for the domains that still have at least one Exchange 2003 server running - Recipient Update Services takes care of populating the email address and Display Name attributes for new distribution lists (and other mail-enabled groups) in those domains. However, we only have Exchange 2010 servers running in one of the domains, and there, the mail-enabled groups never get the proper configuration. I figured out that doing Set-DistributionGroup $groupalias -ForceUpdate after the group was created and had long enough to replicate would cause Exchange to then populate mail, proxyAddresses and DisplayName properly. Here's the Script Policy I've written to check for the presence of mailNickname (Exchange alias) and absence of either mail or DisplayName for groups, and if missing, force those objects up to the Exchange 2010 version:
function onInit($context)
{
# include script library
$context.UseLibraryScript("PS Best Practices")
}
function onPreGet($Request)
{
if($Request.Class -eq "Group")
{
$Request.AddRequestedAttribute("mailNickname")
$Request.AddRequestedAttribute("mail")
$Request.AddRequestedAttribute("displayName")
}
}
function onCheckPropertyValues($Request)
{
if($Request.Class -eq "Group")
{
if ( ($Request.mailNickname -ne $null) -and ( ($Request.mail -eq $null) -or ($Request.DisplayName -eq $null) ) )
{
Add-PSSnapin "Microsoft.Exchange.Management.PowerShell.E2010"
Set-DistributionGroup $Request.mailNickname -ForceUpdate
}
}
}
This isn't working, even when I do a "Check Policy" directly on the distribution list in question, well after the object should have been replicated everywhere. Nothing in the MSExchange log on the AR Server I'm connected to. Any ideas on what I've left out?
Is this something I might be better off doing as a workflow whenever a mail-enabled group is created?