{"id":3747,"date":"2021-10-11T10:33:41","date_gmt":"2021-10-11T09:33:41","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=3747"},"modified":"2021-10-11T10:33:41","modified_gmt":"2021-10-11T09:33:41","slug":"ghost-mailusers","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2021\/10\/ghost-mailusers\/","title":{"rendered":"Ghost Mailusers"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">We had an odd case today that Msft support hasn&#8217;t fixed yet, but in case someone googles the error and finds this, I did find a workaround.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We had a MailUser object that was inactive (soft deleted), but couldn&#8217;t be permanently deleted using <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nRemove-MailUser -PermanentlyDelete -Identity $mailuser.ExternalDirectoryObjectId\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The resulting error was:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>This mail enabled user cannot be permanently deleted since there is a user associated with this mail enabled user in Azure Active Directory. You will first need to delete the user in Azure Active<br>Directory. Please refer to documentation for more details.<\/p><cite>However, nothing was found in AzureAD (or deleted users\/recycle bin), and nothing was present in our on-prem AD.<\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">This user was deleted a long time ago, and now being rehired&#8230;.but account creation was being blocked because the mail user was still claiming the email address of this user.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After some messing around, and not patiently waiting for Msft 1st line support to delete this corrupted MailUser, I discovered the RecalculateInactiveMailUser switch in the set-MailUser command. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Normally, you can&#8217;t modify the primary smtp \/ aliases of a soft deleted mailuser or mailbox&#8230;.BUT, for some reason, if you supply RecalculateInactiveMailUser you can. So:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSet-MailUser -Identity $mailuser.ExternalDirectoryObjectId -EmailAddresses $newProxies -RecalculateInactiveMailUser\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Worked fine! While<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSet-MailUser -Identity $mailuser.ExternalDirectoryObjectId -EmailAddresses $newProxies\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Failed with <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>The operation couldn&#8217;t be performed because object &#8216;270fc89f-0424-42d2-8f54-25796f74457b&#8217; couldn&#8217;t be found on &#8216;DB8PR02A05DC001.EURPR02A005.PROD.OUTLOOK.COM&#8217;.<\/p><p><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>We had an odd case today that Msft support hasn&#8217;t fixed yet, but in case someone googles the error and finds this, I did find a workaround. We had a MailUser object that was inactive (soft deleted), but couldn&#8217;t be permanently deleted using The resulting error was: This mail enabled user cannot be permanently deleted &hellip; <a href=\"https:\/\/lieben.nu\/liebensraum\/2021\/10\/ghost-mailusers\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Ghost Mailusers<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[18,32],"tags":[],"class_list":["post-3747","post","type-post","status-publish","format-standard","hentry","category-exchange-online","category-office-365"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/3747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/comments?post=3747"}],"version-history":[{"count":0,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/3747\/revisions"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=3747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=3747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=3747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}