<!DOCTYPE html> <html> <head> </head> <body> <p> </p> <p><strong>#Disable Address Policy on every contact in the OU (buonvicini.local/Exchange/Recipients External).</strong></p> <p>Get-MailContact -OrganizationalUnit "myorg.org/Exchange/Recipients External" | Set-MailContact -EmailAddressPolicyEnabled:$false</p> <p><strong> </strong></p> <p><strong># Removes the specified email domain from all contacts in the OU (myorg.org/Exchange/Recipients External).</strong><br /><br />Get-MailContact -OrganizationalUnit "myorg.org/Exchange/Recipients External" -ResultSize unlimited -IgnoreDefaultScope | foreach {$contact = $_; <br />$email = $contact.emailaddresses; <br />$email | foreach {if ($_.smtpaddress -like "<span style="color: #ff0000;">*contoso.com</span>") {$address = $_.smtpaddress;}<br />write-host "Removing address" $address "from Contact" $contact.name;<br />Set-Mailcontact -Identity $contact.identity -EmailAddresses @{Remove=$address}; <br />$contact | set-mailcontact -emailaddresspolicyenabled $false}<br />} <br /><br /></p> </body> </html>
Subscribe
0 Comments
Oldest