Frequently Asked Question

Cleaning up Active Directory after an Office365 migration.
Last Updated about a month ago

*** PLEASE NOTE ***

USE THIS AT YOUR OWN RISK

Open PowerShell as administrator on an AD controller.

Use: “ImportModule ActiveDirecotry”

Use: “Get-ADUser -filter {UserPrincipalName -like "[USER@DOMAIN.LOCAL]"} | set-aduser -clear homeMDB,homeMTA,legacyExchangeDN,mail,mailNickname,msExchHomeServer,msExchMailboxGuid,msExchMailboxSecurityDescriptor,msExchPoliciesInclude,msExchRecipientDisplayType,msExchRecipientTypeDetails,msExchUserAccountControl,msExchUserCulture,msExchVersion,proxyAddress,showInAddressBook,targetAddress”

*** PLEASE NOTE ***

You can put “*” for the username to do everyone in AD.

This should only be done after you have uninstalled any/all Microsoft Exchange servers from your domain.

Running this while you have Microsoft Exchange servers on your domain could have detrimental effects.

This will clear all the attribute fields from AD that an Exchange uninstall left behind.


Please Wait!

Please wait... it will take a second!