How to set "mail" attribute of a user account to null/empty?

Copper Contributor

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

8 Replies

@Sascha Halpape 

 

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

Hi 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.

@Sascha Halpape 

 

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!

@Vasil Michev Unfortunately, it didn't help. Thanks anyway for your tips.

Have 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.

Get-ADUser -Identity "SAMAccountName" | Set-ADUser -EmailAddress ""

 

Are you using a PowerShell termination script or manually performing your offboarding?

@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.