From 778dcd93cfd440d835a2542b8a8c0c5ddd69aba7 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Berkleef" Date: Thu, 4 Nov 2021 10:07:47 +0100 Subject: [PATCH] Add -ResultSize Unlimited to all Get-Mailbox calls --- exchange-toolkit.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exchange-toolkit.ps1 b/exchange-toolkit.ps1 index 9e12f39..f6161d4 100644 --- a/exchange-toolkit.ps1 +++ b/exchange-toolkit.ps1 @@ -72,7 +72,7 @@ do #Get the mailboxes from Exchange and print the email addresses to confirm the changes. Foreach ($Alias in $Alias_list) { - $addresses = (Get-Mailbox -Identity $Alias.Displayname).EmailAddresses + $addresses = (Get-Mailbox -ResultSize Unlimited -Identity $Alias.Displayname).EmailAddresses Write-Host -Foregroundcolor Red -Backgroundcolor White (Write-Output $Alias.Displayname); write-Host -foregroundcolor Green -Separator `n (Write-Output $addresses) } @@ -83,7 +83,7 @@ do $CsvSavePath = Read-Host -Prompt 'Input location to save .csv' #List Aliases and select - get-mailbox | Where-Object {$_.EmailAddresses -like "$searchTerm"} | Select-Object Displayname,@{Name="EmailAddresses";Expression={$_.EmailAddresses}} | Export-Csv -NoTypeInformation $CsvSavePath + Get-Mailbox -ResultSize Unlimited | Where-Object {$_.EmailAddresses -like "$searchTerm"} | Select-Object Displayname,@{Name="EmailAddresses";Expression={$_.EmailAddresses}} | Export-Csv -NoTypeInformation $CsvSavePath #Remind the user that they need to fix the csv formatting. Write-Host -ForegroundColor Red -BackgroundColor Black "Please be sure to remember to format the .csv correctly before importing it back into an Exchange Server or Exchange Online" @@ -95,7 +95,7 @@ do $searchTerm = Read-Host -Prompt 'Input Query' #List Aliases - get-mailbox | Where-Object {$_.EmailAddresses -like "$searchTerm"} |ForEach-Object{ + Get-Mailbox -ResultSize Unlimited | Where-Object {$_.EmailAddresses -like "$searchTerm"} |ForEach-Object{ $host.UI.Write("White", $host.UI.RawUI.BackGroundColor, "`nUser Name: " + $_.DisplayName+"`n") @@ -122,7 +122,7 @@ do $searchTerm = Read-Host -Prompt "Search Query" Write-Host -ForegroundColor Blue -BackgroundColor White "Path must be in UNC format for Exchange to export to." $savePath = Read-Host -Prompt "Export Path" - $mailboxes = get-mailbox | Where-Object {$_.EmailAddresses -like "$searchTerm"} + $mailboxes = Get-Mailbox -ResultSize Unlimited | Where-Object {$_.EmailAddresses -like "$searchTerm"} Foreach ($mailbox in $mailboxes) { #Concatenate the save path and the mailbox alias. @@ -138,7 +138,7 @@ do $targetDateFormat = Read-Host -Prompt "Date format to switch to (e.g. "d-M-yyy")" #Search mailboxes and apply the changes - Get-Mailbox | Where-Object {$_.EmailAddresses -like "$searchTerm"} | Set-MailboxRegionalConfiguration -Language "$targetLanguage" -TimeZone "$targetTimezone" -DateFormat "$targetDateFormat" + Get-Mailbox -ResultSize Unlimited | Where-Object {$_.EmailAddresses -like "$searchTerm"} | Set-MailboxRegionalConfiguration -Language "$targetLanguage" -TimeZone "$targetTimezone" -DateFormat "$targetDateFormat" } }