FN-GM Posted April 30, 2017 Posted April 30, 2017 (edited) Hello, I am retiring an old domain. We have a large number of users that have this domain as a proxy address in AD. This was to provide a second email address in Office 365 whilst they change everything to the new domain. Does anyone have a script the will search users and remove any proxy address that contains the old domain please? I can't use any commands that require exchange. We don't have a on premise server and can't run them on Office 365 due to DirSync. I did have one, but I can't find it nor can I find one of Google. Thanks Edited April 30, 2017 by FN-GM
FN-GM Posted April 30, 2017 Author Posted April 30, 2017 I have made this. It does search the right users but doesn't delete the proxy address. I assume its the wildcard in Set-ADUser Get-ADuser -SearchBase "OU=ouname,DC=domain,DC=local" -ldapFilter "(&(proxyaddresses=smtp:*@olddomain.com*))" | Set-ADUser -Remove @{ProxyAddresses="smtp:*@olddomain.com"}
FN-GM Posted April 30, 2017 Author Posted April 30, 2017 Not tried it yet, but I could probably adopt this Removing .onmicrosoft.com and .mail.onmicrosoft.com aliases from all groups, users and contacts in your Active Directory | Liebensraum
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now