Forum Discussion
Sascha Halpape
Feb 19, 2020Copper Contributor
How to set "mail" attribute of a user account to null/empty?
Dear community,
if we deactivate users that we originally synchronized from our on premise ad and take away their license, they keep their email address in the mail attribute.
Can anyone tell me how to set the attribute to null?
Best regards
Sascha
- ATKaiBrass ContributorHave you figured out a way to set it to null? I also need to set it to null but I haven't found a way yet.
- ChrissyNCopper Contributor
Get-ADUser -Identity "SAMAccountName" | Set-ADUser -EmailAddress ""
Are you using a PowerShell termination script or manually performing your offboarding?
- Sascha HalpapeCopper Contributor
ChrissyN We did the offboarding manually. The commands you posted are for on premise AD. So I think they cannot be used for the cloud accounts.
Generally speaking, you cannot. You can try the method detailed here: https://techcommunity.microsoft.com/t5/exchange-team-blog/permanently-clear-previous-mailbox-info/ba-p/607619
Or here, depending on the situation: https://www.michev.info/Blog/Post/2388/permanently-disable-a-mailbox-in-office-365
- Sascha HalpapeCopper Contributor
VasilMichev Unfortunately, it didn't help. Thanks anyway for your tips.
- RaizelXBrass Contributor
If this object is synchronized from your AD and has an old on-premise exchange account and you just want to provision a new cloud mailbox.
Clear the following attributes then force a sync.
1. MsExchMailboxGuid
2. MsExchRecipientDisplayType
3. MsExchRecipientTypeDetails
- Sascha HalpapeCopper ContributorHi RaizelX,
the objects are no longer synced and we don't have an on premise AD or Exchange anymore. I don't want to provision a new cloud mailbox. We deactivate old accounts and remove the licenses. I do not understand why the email address is not removed from the attribute.- RaizelXBrass Contributor
Oh, I see. You just want to clear the mail attributes as you already have removed the licenses. I haven't tried to do so but maybe you can use the Remove-Mailbox cmdlet? Thank you!