{"id":4314,"date":"2019-09-08T23:07:44","date_gmt":"2019-09-08T23:07:44","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=4314"},"modified":"2019-09-08T23:07:44","modified_gmt":"2019-09-08T23:07:44","slug":"powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks","title":{"rendered":"Powershell Script to Export Exchange mailbox to smaller PST Chunks"},"content":{"rendered":"<p>Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast<\/p><p>&nbsp;<\/p><p>[pastacode lang=&#8221;markdown&#8221; manual=&#8221;Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20&#8217;%24startofmonth&#8217;)%20-and%20(Received%20-lt%20&#8217;%24endofmonth&#8217;))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A&#8221; message=&#8221;&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]<\/p>","protected":false},"excerpt":{"rendered":"<p>Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast&nbsp;[pastacode lang=&#8221;markdown&#8221; manual=&#8221;Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20&#8217;%24startofmonth&#8217;)%20-and%20(Received%20-lt%20&#8217;%24endofmonth&#8217;))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A&#8221; message=&#8221;&#8221; highlight=&#8221;&#8221; provider=&#8221;manual&#8221;\/]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4314","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast [pastacode lang=&quot;markdown&quot; manual=&quot;Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20&#039;%24startofmonth&#039;)%20-and%20(Received%20-lt%20&#039;%24endofmonth&#039;))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A&quot; message=&quot;&quot; highlight=&quot;&quot; provider=&quot;manual&quot;\/]\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"paris\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Welcome to Pariswells.com |\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Powershell Script to Export Exchange mailbox to smaller PST Chunks | Welcome to Pariswells.com\" \/>\n\t\t<meta property=\"og:description\" content=\"Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast [pastacode lang=&quot;markdown&quot; manual=&quot;Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20&#039;%24startofmonth&#039;)%20-and%20(Received%20-lt%20&#039;%24endofmonth&#039;))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A&quot; message=&quot;&quot; highlight=&quot;&quot; provider=&quot;manual&quot;\/]\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-09-08T23:07:44+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-09-08T23:07:44+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Powershell Script to Export Exchange mailbox to smaller PST Chunks | Welcome to Pariswells.com\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast [pastacode lang=&quot;markdown&quot; manual=&quot;Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20&#039;%24startofmonth&#039;)%20-and%20(Received%20-lt%20&#039;%24endofmonth&#039;))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A&quot; message=&quot;&quot; highlight=&quot;&quot; provider=&quot;manual&quot;\/]\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#article\",\"name\":\"Powershell Script to Export Exchange mailbox to smaller PST Chunks | Welcome to Pariswells.com\",\"headline\":\"Powershell Script to Export Exchange mailbox to smaller PST Chunks\",\"author\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#organization\"},\"datePublished\":\"2019-09-08T23:07:44+00:00\",\"dateModified\":\"2019-09-08T23:07:44+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#webpage\"},\"articleSection\":\"Research\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pariswells.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/research#listItem\",\"name\":\"Research\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/research#listItem\",\"position\":2,\"name\":\"Research\",\"item\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/research\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#listItem\",\"name\":\"Powershell Script to Export Exchange mailbox to smaller PST Chunks\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#listItem\",\"position\":3,\"name\":\"Powershell Script to Export Exchange mailbox to smaller PST Chunks\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/research#listItem\",\"name\":\"Research\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#organization\",\"name\":\"Welcome to Pariswells.com\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris\",\"name\":\"paris\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93b8ee3f592ac401167f870452bd82d43de80152cd3524e2853403658ada9984?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"paris\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#webpage\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks\",\"name\":\"Powershell Script to Export Exchange mailbox to smaller PST Chunks | Welcome to Pariswells.com\",\"description\":\"Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast [pastacode lang=\\\"markdown\\\" manual=\\\"Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20'%24startofmonth')%20-and%20(Received%20-lt%20'%24endofmonth'))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A\\\" message=\\\"\\\" highlight=\\\"\\\" provider=\\\"manual\\\"\\\/]\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\"},\"datePublished\":\"2019-09-08T23:07:44+00:00\",\"dateModified\":\"2019-09-08T23:07:44+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/\",\"name\":\"Welcome to Pariswells.com\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Powershell Script to Export Exchange mailbox to smaller PST Chunks | Welcome to Pariswells.com","description":"Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast [pastacode lang=\"markdown\" manual=\"Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20'%24startofmonth')%20-and%20(Received%20-lt%20'%24endofmonth'))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A\" message=\"\" highlight=\"\" provider=\"manual\"\/]","canonical_url":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#article","name":"Powershell Script to Export Exchange mailbox to smaller PST Chunks | Welcome to Pariswells.com","headline":"Powershell Script to Export Exchange mailbox to smaller PST Chunks","author":{"@id":"https:\/\/pariswells.com\/blog\/author\/paris#author"},"publisher":{"@id":"https:\/\/pariswells.com\/blog\/#organization"},"datePublished":"2019-09-08T23:07:44+00:00","dateModified":"2019-09-08T23:07:44+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#webpage"},"isPartOf":{"@id":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#webpage"},"articleSection":"Research"},{"@type":"BreadcrumbList","@id":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/pariswells.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/category\/research#listItem","name":"Research"}},{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/category\/research#listItem","position":2,"name":"Research","item":"https:\/\/pariswells.com\/blog\/category\/research","nextItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#listItem","name":"Powershell Script to Export Exchange mailbox to smaller PST Chunks"},"previousItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#listItem","position":3,"name":"Powershell Script to Export Exchange mailbox to smaller PST Chunks","previousItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/category\/research#listItem","name":"Research"}}]},{"@type":"Organization","@id":"https:\/\/pariswells.com\/blog\/#organization","name":"Welcome to Pariswells.com","url":"https:\/\/pariswells.com\/blog\/"},{"@type":"Person","@id":"https:\/\/pariswells.com\/blog\/author\/paris#author","url":"https:\/\/pariswells.com\/blog\/author\/paris","name":"paris","image":{"@type":"ImageObject","@id":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/93b8ee3f592ac401167f870452bd82d43de80152cd3524e2853403658ada9984?s=96&d=mm&r=g","width":96,"height":96,"caption":"paris"}},{"@type":"WebPage","@id":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#webpage","url":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks","name":"Powershell Script to Export Exchange mailbox to smaller PST Chunks | Welcome to Pariswells.com","description":"Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast [pastacode lang=\"markdown\" manual=\"Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20'%24startofmonth')%20-and%20(Received%20-lt%20'%24endofmonth'))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A\" message=\"\" highlight=\"\" provider=\"manual\"\/]","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/pariswells.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks#breadcrumblist"},"author":{"@id":"https:\/\/pariswells.com\/blog\/author\/paris#author"},"creator":{"@id":"https:\/\/pariswells.com\/blog\/author\/paris#author"},"datePublished":"2019-09-08T23:07:44+00:00","dateModified":"2019-09-08T23:07:44+00:00"},{"@type":"WebSite","@id":"https:\/\/pariswells.com\/blog\/#website","url":"https:\/\/pariswells.com\/blog\/","name":"Welcome to Pariswells.com","inLanguage":"en-US","publisher":{"@id":"https:\/\/pariswells.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Welcome to Pariswells.com |","og:type":"article","og:title":"Powershell Script to Export Exchange mailbox to smaller PST Chunks | Welcome to Pariswells.com","og:description":"Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast [pastacode lang=&quot;markdown&quot; manual=&quot;Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20'%24startofmonth')%20-and%20(Received%20-lt%20'%24endofmonth'))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A&quot; message=&quot;&quot; highlight=&quot;&quot; provider=&quot;manual&quot;\/]","og:url":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks","article:published_time":"2019-09-08T23:07:44+00:00","article:modified_time":"2019-09-08T23:07:44+00:00","twitter:card":"summary","twitter:title":"Powershell Script to Export Exchange mailbox to smaller PST Chunks | Welcome to Pariswells.com","twitter:description":"Powershell Script to Export Exchange mailboxes in 20GB PST allotments for upload to Mimecast [pastacode lang=&quot;markdown&quot; manual=&quot;Import-Module%20activedirectory%0A%0A%24TargetUserName%3D%22jsmith%22%0A%24Useremail%3D%22jsmith%40domain.com%0A%24Location%20%3D%20%22%5C%5C10.1.10.18%5CArchiveExport%5C%22%0A%0A%24FirstEmail%20%3D%20Get-MailboxFolderStatistics%20%24TargetUserName%20-IncludeOldestAndNewestItems%20%7C%20%3F%20%7B%24_.OldestItemReceivedDate%7D%20%7C%20Sort-Object%20OldestItemReceivedDate%20%7C%20Select%20-ExpandProperty%20OldestItemReceivedDate%20-First%201%0A%24FirstEmail%20%3D%20%24FirstEmail.ToString(%22MM%2Fdd%2Fyyyy%22)%0A%0A%24finish%20%3D%20%24FirstEmail%0A%0A%23The%20end%20date%20of%20when%20the%20last%20email%20wants%20to%20be%20exported%20%2C%20if%20using%20Mimecast%20this%20will%20be%20the%20date%20of%20enabling%20archiving%0A%24startdate%20%3D%20Get-Date%0A%0A%24startofmonth%20%3D%20Get-Date%20%24startdate%20-day%201%20-hour%200%20-minute%200%20-second%200%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0A%24pstnumber%20%3D%201%0A%0Ado%20%7B%0A%24startvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24startofmonth%0A%0A%24endvalue%20%3D%20Get-Date%20-format%20d%20-Date%20%24endofmonth%0A%0ANew-MailboxExportRequest%20%24TargetUserName%20-ContentFilter%20%22((Received%20-gt%20'%24startofmonth')%20-and%20(Received%20-lt%20'%24endofmonth'))%22%20-FilePath%20%24Location%24Useremail%22.pst%22%20-Confirm%3A%24false%0A%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%0ADo%7B%0AStart-Sleep%2010%0A%24ExportStats%20%3D%20Get-MailboxExportRequest%20-Mailbox%20%24TargetUserName%0A%24ExportStatus%20%3D%20%24ExportStats.Status%0A%7D%20while%20(%24ExportStatus%20-eq%20%22Queued%22%20-or%20%24ExportStatus%20-eq%20%22InProgress%22)%0A%0AStart-Sleep%2030%0A%0AGet-MailboxExportRequest%20-mailbox%20%24targetusername%20-Status%20%22Completed%22%20%7C%20Remove-MailboxExportRequest%20-Confirm%3A%24false%0A%0AStart-Sleep%2030%0A%0Aif((Get-Item%20%24Location%24useremail%22.pst%22).length%20-gt%2020gb)%20%7B%0ARename-Item%20%24Location%24Useremail%E2%80%9D.PST%E2%80%9D%20%24Location%24Useremail%E2%80%9D.%E2%80%9C%24pstnumber%E2%80%9D.PST%E2%80%9D%0A%24pstnumber%2B%2B%0A%7D%0A%0A%24startofmonth%20%3D%20((%24startofmonth).AddMonths(-1))%0A%0A%24endofmonth%20%3D%20((%24startofmonth).AddMonths(1).AddSeconds(-1))%0A%0AStart-Sleep%2030%0A%0A%7D%0A%0Awhile%20(%24startofmonth%20-ge%20%24finish)%0A&quot; message=&quot;&quot; highlight=&quot;&quot; provider=&quot;manual&quot;\/]"},"aioseo_meta_data":{"post_id":"4314","title":null,"description":null,"keywords":null,"keyphrases":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-21 05:28:51","updated":"2022-09-22 10:19:36","primary_term":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/pariswells.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/pariswells.com\/blog\/category\/research\" title=\"Research\">Research<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tPowershell Script to Export Exchange mailbox to smaller PST Chunks\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/pariswells.com\/blog"},{"label":"Research","link":"https:\/\/pariswells.com\/blog\/category\/research"},{"label":"Powershell Script to Export Exchange mailbox to smaller PST Chunks","link":"https:\/\/pariswells.com\/blog\/research\/powershell-script-to-export-exchange-mailbox-to-smaller-pst-chunks"}],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=4314"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4314\/revisions"}],"predecessor-version":[{"id":4315,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4314\/revisions\/4315"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=4314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=4314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=4314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}