{"id":2235,"date":"2018-08-15T10:53:52","date_gmt":"2018-08-15T08:53:52","guid":{"rendered":"https:\/\/msb365.abstergo.ch\/?p=2235"},"modified":"2023-06-23T13:19:49","modified_gmt":"2023-06-23T11:19:49","slug":"powershell-does-not-reflect-the-correct-server-for-mailboxes","status":"publish","type":"post","link":"https:\/\/www.msb365.blog\/?p=2235","title":{"rendered":"PowerShell does not reflect the correct server for Mailboxes"},"content":{"rendered":"<p>By preparing tasks for a customer\u2019s Enterprise Vault\u00a0 I had to figure out on which Mailbox Database and on which Exchange server a user mailbox is located. However, the easiest way to figure this out is to use PowerShell.<\/p>\n<p>For this case, I had to hit the following command to the Exchange Management console:<\/p>\n<pre class=\"\">Get-Mailbox \u2013Identity <alias> | select *server*,*database*<\/pre>\n<p>\u00a0<\/p>\n<p>As we can see in the example on the picture below, the Mailbox should be located on the Exchange Server xxxx005<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-2238\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/AD084C49.png\" alt=\"\" width=\"1673\" height=\"204\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/AD084C49.png 1673w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/AD084C49-300x37.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/AD084C49-768x94.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/AD084C49-1024x125.png 1024w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/AD084C49-600x73.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/AD084C49-1600x195.png 1600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/AD084C49-780x95.png 780w\" sizes=\"(max-width: 1673px) 100vw, 1673px\" \/><\/p>\n<p>However, if we go now to the Exchange ECP and we check there the DAG databases is shows another result:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2239\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/8AF1F5B6.png\" alt=\"\" width=\"1303\" height=\"365\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/8AF1F5B6.png 1303w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/8AF1F5B6-300x84.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/8AF1F5B6-768x215.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/8AF1F5B6-1024x287.png 1024w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/8AF1F5B6-600x168.png 600w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/8AF1F5B6-780x218.png 780w\" sizes=\"(max-width: 1303px) 100vw, 1303px\" \/><\/p>\n<p>Honestly, this is confusing. To which output we need to believe now? Well from the logical point of view to the ECP output.<\/p>\n<p>If we go back to the PowerShell output, we see that the Mailbox is located on the 16db03xxxx Mailbox database. This database is a DAG member and has multiple copies on several Exchange Servers. However, as we can see in the ECP, the active Database is running on the Exchange Server xxxx006.<\/p>\n<p>\u00a0<\/p>\n<p>By investigating on the Microsoft Technet, I have fond the following answer from the Microsoft Exchange Team:<\/p>\n<p><span style=\"color: #3366ff;\">\u201cWe got notified from customers, that the powershell commandlet get-mailbox in Exchange 2010 (see http:\/\/technet.microsoft.com\/en-us\/library\/bb123685(v=exchg.141).aspx) and in Exchange 2013 (see http:\/\/technet.microsoft.com\/en-us\/library\/bb123685(v=exchg.150).aspx) do not always return the correct ServerName\u00a0 or ServerLegacyDn for the given mailbox. Those customers often rely for their backups or customized mailbox processes on the information, on which server a given mailbox is currently located.<\/span><\/p>\n<p><span style=\"color: #3366ff;\">We told our customers, that their findings are indeed true and\u00a0 that these attributes, which are returned via get-mailbox are written only at special events, like at creation time of the mailbox or after a move mailbox has taken place. On a DAG the mailbox database can be owned by any of the possible owners of that database. Changing the possible owner of that database is considered to be a circumstance of making sure, that this database is healthy. At any time the smooth switch to a different owner is much more important than the update of all the properties of the mailboxes on that database. The update of the ServerName property with a mailbox comes with a certain performance penalty. Our product group decided therefore not to take that penalty for Database moves to a different possible owner.\u201d<\/span><\/p>\n<p>\u00a0<\/p>\n<p>Well, good to know, but is there a solution or workaround for this problem? \u2013 I would say yes!<\/p>\n<p>To get the right output from the Exchange Management Shell we can use the following command:<\/p>\n<pre class=\"\">Get-MailboxStatistics <mailboxID> | select Displayname, Servername, *database*<\/pre>\n<p>Or as an alternative<\/p>\n<pre class=\"\">Get-Mailbox | Get-MailboxStatistics | select Displayname, Servername, *database*<\/pre>\n<p>If Displayname is too ambiguous, you may use Identity or PrimarySMTPAddress instead.<\/p>\n<p>As example here a possible output:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2240\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/rffrh.png\" alt=\"\" width=\"612\" height=\"146\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/rffrh.png 612w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/rffrh-300x72.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2018\/07\/rffrh-600x143.png 600w\" sizes=\"(max-width: 612px) 100vw, 612px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>Photo by\u00a0<a href=\"https:\/\/unsplash.com\/photos\/-Cmz06-0btw?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText\">NeONBRAND<\/a>\u00a0on\u00a0<a href=\"https:\/\/unsplash.com\/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText\">Unsplash<\/a><\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By preparing tasks for a customer\u2019s Enterprise Vault\u00a0 I had to figure out on which Mailbox Database and on which Exchange server a user mailbox is located. However, the easiest way to figure this out is to use PowerShell. For this case, I had to hit the following command to the Exchange Management console: Get-Mailbox [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2236,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1923,2,3],"tags":[],"class_list":["post-2235","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-365","category-exchange","category-powershell"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts\/2235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2235"}],"version-history":[{"count":5,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts\/2235\/revisions"}],"predecessor-version":[{"id":5221,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts\/2235\/revisions\/5221"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/media\/2236"}],"wp:attachment":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}