New email address policy based on mailbox database
I'm trying to create an email address policy for users on a specific mailbox database. I've been through a couple of posts here with the PS commands but I'm not having any luck getting the policy sucessfully created. I have an exchange 2007 SP1 RU9 server in a dev domain. I'm running the following command: New-EmailAddressPolicy -Name test.com -EnabledPrimarySMTPAddressTemplate SMTP:@test.com -RecipientFilter {((Database -eq "DEVEX01\TEST-Mailbox-Store1\TEST-Mailbox-Database1") -and (RecipientType -eq 'UserMailbox'))} I get the following error output: New-EmailAddressPolicy : Cannot bind parameter 'RecipientFilter' to the target. Exception setting "RecipientFilter": "The value "DEVEX01\TEST-Mailbox-Store1\TEST-Mailbox-Database1" could not be converted to type Microsoft.Exchange.Data.Directory.ADObjectId."At line:1 char:120+ New-EmailAddressPolicy -Name "Test.com" -EnabledPrimarySMTPAddressTemplate `SMTP:@TEST.com' -RecipientFilter <<<< {((Database -eq "DEVEX01\TEST-Mailbox-Store1\TEST-Mailbox-Database1") -and (RecipientType -eq 'UserMailbox'))}Now if I change the database to just "TEST-Mailbox-Database1" instead of the full path, the policy gets created, but it doesn't look like the policy is being applied.
September 4th, 2009 9:46pm
Hi, Did you try giving DN instead of ID of the database in the filter? To get the DN of the database... Get-MailboxDatabase -id "DEVEX01\TEST-Mailbox-Store1\TEST-Mailbox-Database1" | fl Distin* Creating Email Address policy... New-EmailAddressPolicy -Name test -EnabledPrimarySMTPAddressTemplate SMTP:@test.com -RecipientFilter {(Database -eq "DN of the database" -and RecipientType -eq "UserMailbox")} Also please let us know how do you notice that the policy is not applied to the user. Please note that By Default Policies are applied when users are created or you change some attribute of the object manually. i suggest you try creating a new user with the EmailAddressPolicyEnabled = $true attribute. Thanks.
Vishal Ramnani | MCITP - Exchange 2007 | MCSE Messaging | MCTS - Win 2008 Config
Free Windows Admin Tool Kit Click here and download it now
September 4th, 2009 11:12pm
Thanks Vishal! Once I put the DN into the command the policy applied correctly. I figured the policy wasn't applying when Iwasn't seeing the SMTP domain being updated on the test users when I applied the policy. Also, If yougo into the EMC and edited the policy there is a preview button there. I wasn't seeing any users in the preview before. Now I see the test users when I hit the preview button.
September 9th, 2009 3:08pm