{"id":9051,"date":"2016-06-25T17:18:05","date_gmt":"2016-06-26T00:18:05","guid":{"rendered":"http:\/\/riguy.com\/?page_id=9051"},"modified":"2019-03-24T20:01:54","modified_gmt":"2019-03-25T03:01:54","slug":"exchange-management-shell","status":"publish","type":"page","link":"https:\/\/riguy.com\/?page_id=9051","title":{"rendered":"Exchange 2010 or 2013 Management Shell"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Here are some simple Exchange Management Shell commands for a few common tasks I had encountered over the past several years. I like to have a quick web reference &#8216;sheet&#8217; in case I need the information fast. These commands involve Exchange server 2010 but generally will work for 2013 as well. Focus is on: exporting mailbox to archive [.PST] and getting an update on the export; updating a Global address list quickly; removing a disconnected mailbox; working quotas and certificates, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Export Mailboxes to PST sample:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211;&gt; New-MailboxExportRequest -Mailbox ExampleUser -FilePath &#8220;\\\\EXCH10ZZ-M\\PSTs$\\ExampleUser.pst&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211;&gt; Get-MailboxExportRequest | Get-MailboxExportRequestStatistics<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211;&gt; Get-MailboxExportRequest | Remove-MailboxExportRequest<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">~~~~~~<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To immediately update the GAL, go to the Exchange shell, and do the following (steps 2-4, step 1 MAY not be needed in some cases; it depends on the extent of the Active Directory set up):<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. AD Sites + Services: replicate AD to all DCs via NTDS etc. (ref. MS Technet)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Use PowerShell or Go to the EMC to manually update the OAB: in EMC: go to Organization Configuration\/Mailbox\/Offline Address Book then right click the address book as needed<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Open Services.msc off the Exchange server &gt; Restart the System Attendant Service<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Shell &gt; run: Update-FileDistributionService at command pipeline position 1<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Supply values for the following parameters:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Identity: [Exchange Server name]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After the above, the GAL needs to be downloaded within Outlook &#8211; Send-Receive Groups\/Full Details in each user&#8217;s Outlook to reflect changes, else shows within a few hours<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">~~~~~~~~~~~~~~~<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Completely Remove a Disconnected mailbox [note mailboxes will usually clear out within several days, but if one or two are hanging around]:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In Exchange 2007 &amp; 2010, there is no way to remove a disconnected mailbox in the console. We can use the \u201cRemove-StoreMailbox\u201d command to remove it in 2010. To remove a mailbox permanently:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Remove-StoreMailbox \u2013database \u201cMailDatabaseName\u201d \u2013identity \u201cExampleUser\u201d \u2013MailboxState Disabled<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, run:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get-MailboxDatabase | Clean-MailDatbaseName to refresh the console.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">More:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get all Mailbox or DB Quota related info:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get-Mailbox -Database Exch10ZZ-M | FL name,issuewarningquota,prohibitsendquota,prohibitsendrecievequota &gt; c:\\Temp\\Quotas.txt<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get-MailboxDatabase -Server SERVERNAME | FL name,issuewarningquota,prohibitsendquota,prohibitsendrecievequota<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">get-mailbox -filter { usedatabasequotadefaults -eq $false -AND recipientTypeDetails -eq &#8216;usermailbox&#8217; }<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">CAREFUL HERE:[sets quota<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get-Mailbox -Database DatabaseName | Set-Mailbox IssueWarningQuotasize<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">-UseDatabaseQuotaDefaults $boolean value<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">**** Track Mailbox Sizes!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">i.e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get-Mailbox -database MailDatabaseName | Get-MailboxStatistics | Sort-Object TotalItemSize -descend | Select-Object DisplayName,ItemCount,@{name=&#8221;MailboxSize&#8221;;exp={$_.totalitemsize}}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">~~~<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Certificates:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get-ExchangeCertificate | fl<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are some simple Exchange Management Shell commands for a few common tasks I had encountered over the past several years. I like to have a quick web reference &#8216;sheet&#8217; in case I need the information fast. These commands involve Exchange server 2010 but generally will work for 2013 as well. Focus is on: exporting &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/riguy.com\/?page_id=9051\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Exchange 2010 or 2013 Management Shell&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":801,"menu_order":4,"comment_status":"open","ping_status":"closed","template":"","meta":{"_crdt_document":"","footnotes":""},"class_list":["post-9051","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/riguy.com\/index.php?rest_route=\/wp\/v2\/pages\/9051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/riguy.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/riguy.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/riguy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/riguy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9051"}],"version-history":[{"count":7,"href":"https:\/\/riguy.com\/index.php?rest_route=\/wp\/v2\/pages\/9051\/revisions"}],"predecessor-version":[{"id":10574,"href":"https:\/\/riguy.com\/index.php?rest_route=\/wp\/v2\/pages\/9051\/revisions\/10574"}],"up":[{"embeddable":true,"href":"https:\/\/riguy.com\/index.php?rest_route=\/wp\/v2\/pages\/801"}],"wp:attachment":[{"href":"https:\/\/riguy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}