-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Boonham
authored and
Chris Boonham
committed
Oct 17, 2024
1 parent
854bf81
commit 74f90a8
Showing
3 changed files
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
#Requires -Modules @{ ModuleName="ExchangeOnlineManagement"; RequiredVersion="3.4.0" } | ||
|
||
<# | ||
.SYNOPSIS | ||
Retrieves folder statistics for mailboxes with large numbers of folders. | ||
|
@@ -25,7 +27,7 @@ | |
.EXAMPLE | ||
$folderStats = .\Get-LargeMailboxFolderStatistics.ps1 -Identity [email protected] | ||
$folderStats = .\Get-LargeMailboxFolderStatistics.ps1 -Identity [email protected] -MailboxType Primary | ||
$folderStats = .\Get-LargeMailboxFolderStatistics.ps1 -Identity [email protected] -MailboxType Archive -BatchSize 5000 -Properties "Name, FolderPath" | ||
$folderStats = .\Get-LargeMailboxFolderStatistics.ps1 -Identity [email protected] -MailboxType Archive -BatchSize 5000 -Properties @("Name", "FolderPath") | ||
#> | ||
param( | ||
[Parameter(Mandatory = $true, Position = 0)] | ||
|
@@ -40,8 +42,7 @@ param( | |
) | ||
|
||
Process { | ||
$allContentFolders = $null | ||
$propertyArray = $Properties -split ',' | ForEach-Object { $_.Trim() } | ||
$allContentFolders = New-Object System.Collections.Generic.List[System.Management.Automation.PSCustomObject] | ||
$start = Get-Date | ||
Write-Host "$start Running Get-MailboxFolderStatistics for $Identity $MailboxType locations, in batches of $BatchSize" | ||
|
||
|
@@ -53,7 +54,7 @@ Process { | |
do { | ||
$skipCount = $BatchSize * $loopCount | ||
$batch = Get-MailboxFolderStatistics -Identity $($location.Identity) -ResultSize $batchSize -SkipCount $skipCount | ||
$allContentFolders += $batch | Where-Object { $_.ContentFolder -eq "TRUE" } | Select-Object -Property $propertyArray | ||
$allContentFolders += $batch | Where-Object { $_.ContentFolder -eq "TRUE" } | Select-Object -Property $Properties | ||
Write-Host "$(Get-Date):$loopCount Found $($batch.Count) content folders from $($location.MailboxLocationType):$($location.MailboxGuid)" | ||
$loopCount += 1 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ $folderStats = .\Get-LargeMailboxFolderStatistics.ps1 -Identity [email protected] | |
|
||
Example to get the mailbox folder statistics for a Archive mailbox, in batches of 5000 and just the folder properties Name and FolderPath | ||
```PowerShell | ||
$folderStats = .\Get-LargeMailboxFolderStatistics.ps1 -Identity [email protected] -MailboxType Archive -BatchSize 5000 -Properties "Name, FolderPath" | ||
$folderStats = .\Get-LargeMailboxFolderStatistics.ps1 -Identity [email protected] -MailboxType Archive -BatchSize 5000 -Properties @("Name", "FolderPath") | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters