From fabd973787ae54f0884bde4f03e297b03d6e9a43 Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Tue, 26 Oct 2021 12:37:48 +0200 Subject: [PATCH 01/10] modify comparison --- ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index e1a4cb0..2a7a4e1 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -428,7 +428,7 @@ catch { $counter=1 foreach($sharedMBX in $sharedMBXs) { - if ($sharedMBX.ForwardingAddress -match $dg.name -or $sharedMBX.ForwardingSmtpAddress -match $dg.PrimarySmtpAddress) + if ($sharedMBX.ForwardingAddress -eq $dg.name -or $sharedMBX.ForwardingSmtpAddress -match $dg.PrimarySmtpAddress) { $Conditionfwdmbx= $Conditionfwdmbx+$sharedMBX $counter++ From 9aa3b58e9e8db661bb995470f4d5a9245eeef083 Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Tue, 26 Oct 2021 13:08:15 +0200 Subject: [PATCH 02/10] modify comparison for shared mbx condition --- ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index 2a7a4e1..55de692 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -428,7 +428,7 @@ catch { $counter=1 foreach($sharedMBX in $sharedMBXs) { - if ($sharedMBX.ForwardingAddress -eq $dg.name -or $sharedMBX.ForwardingSmtpAddress -match $dg.PrimarySmtpAddress) + if ($sharedMBX.ForwardingAddress -eq $dg.name -or $sharedMBX.ForwardingSmtpAddress -eq $dg.PrimarySmtpAddress) { $Conditionfwdmbx= $Conditionfwdmbx+$sharedMBX $counter++ From 60ee3a4feb60b039cb98ec2a692ab8239ec7f7bd Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Thu, 28 Oct 2021 15:36:37 +0200 Subject: [PATCH 03/10] add progress to all dgs part --- .../Start-DlToO365GroupUpgradeChecks.ps1 | 62 +++---------------- 1 file changed, 7 insertions(+), 55 deletions(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index 55de692..7d42a9d 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -127,29 +127,13 @@ $ConditionEAP=New-Object PSObject # Bypass that step if there's no EAP if($null -ne $eap) { - #added case sensitive operator to catch any difference even in letters of smtp address - #add case sensitive condition with information in case found a violation + #Case sensitive operator to catch any difference even in letters of smtp address + $ViolatedEap = @( $eap | where-object{$_.RecipientFilter -eq "RecipientTypeDetails -eq 'GroupMailbox'" -and $_.EnabledPrimarySMTPAddressTemplate.ToString().Split("@")[1] -cne $dg.PrimarySmtpAddress.ToString().Split("@")[1]}) if ($ViolatedEap.Count -ge 1) { - <#$count=1 - foreach($violateeap in $ViolatedEap) - { - $ConditionEAP|Add-Member -NotePropertyName "EmailAddressPolicy$count Name" -NotePropertyValue $violateeap - $count++ - } - #> - #check if it's case sensitive or not - <# - $GetnotcasesensintiveiolatedEap = @( $eap | where-object{$_.RecipientFilter -eq "RecipientTypeDetails -eq 'GroupMailbox'" -and $_.EnabledPrimarySMTPAddressTemplate.ToString().Split("@")[1] -ne $dg.PrimarySmtpAddress.ToString().Split("@")[1]}) - if($ViolatedEap|ForEach-Object{$_.EnabledPrimarySMTPAddressTemplate.split("@")[1] -ne $GetnotcasesensintiveiolatedEap.EnabledPrimarySMTPAddressTemplate.split("@")[1]}) - { - #Case sensitive EAP found - } - #> $ConditionEAP=$ViolatedEap|Select-Object Identity,Priority,@{label='PrimarySMTPAddressTemplate';expression={($_.EnabledPrimarySMTPAddressTemplate).split("@")[1]}} |Sort-Object priority [PSCustomObject]$ConditionEAPHTML = New-ObjectForHTMLReport -SectionTitle $SectionTitle -SectionTitleColor "Red" -Description $Description -DataType "CustomObject" -EffectiveDataArrayList $ConditionEAP -TableType "Table" $null = $TheObjectToConvertToHTML.Add($ConditionEAPHTML) - } else { $ConditionNOEAP="NO matching Group Email Address Policy for the groups on the organization" @@ -162,41 +146,8 @@ else { $null = $TheObjectToConvertToHTML.Add($ConditionEAPHTML) } - #endregion Check if Distribution Group can't be upgraded because EmailAddressPolicyViolated -<# -#region Check if Distribution Group can't be upgraded because DlHasChildGroups -[string]$SectionTitle = "Validating Distribution Group Child Membership" -[string]$Description = "Checking if Distribution Group can't be upgraded because it contains child groups" -$ConditionChildDG=New-Object PSObject -try { - $members = Get-DistributionGroupMember $($dg.Guid.ToString()) -ErrorAction stop - $CurrentProperty = "Retrieving: $dgsmtp members" - $CurrentDescription = "Success" - write-log -Function "Retrieve Distribution Group membership" -Step $CurrentProperty -Description $CurrentDescription -} -catch { - $CurrentProperty = "Retrieving: $dgsmtp members" - $CurrentDescription = "Failure" - write-log -Function "Retrieve Distribution Group membership" -Step $CurrentProperty -Description $CurrentDescription -} -$childgroups = $members | Where-Object{ $_.RecipientTypeDetails -eq "MailUniversalDistributionGroup"} -if ($null -ne $childgroups) { - $count=1 - foreach($childgroup in $childgroups) - { - $ConditionChildDG|Add-Member -NotePropertyName "Child Group$count ALias" -NotePropertyValue $childgroup.Alias - $count++ - } - [PSCustomObject]$ConditionChildDGHTML = New-ObjectForHTMLReport -SectionTitle $SectionTitle -SectionTitleColor "Red" -Description $Description -DataType "CustomObject" -EffectiveDataArrayList $ConditionChildDG -TableType "Table" - $null = $TheObjectToConvertToHTML.Add($ConditionChildDGHTML) -} -else { - $ConditionChildDG|Add-Member -NotePropertyName "Child Group ALias" -NotePropertyValue "No child groups found" - [PSCustomObject]$ConditionChildDGHTML = New-ObjectForHTMLReport -SectionTitle $SectionTitle -SectionTitleColor "Green" -Description $Description -DataType "CustomObject" -EffectiveDataArrayList $ConditionChildDG -TableType "Table" - $null = $TheObjectToConvertToHTML.Add($ConditionChildDGHTML) -} -#endregion Check if Distribution Group can't be upgraded because DlHasChildGroups -#> +#endregion Check if Distribution Group can't be upgraded because EmailAddressPolicyViolated + #region Check if Distribution Group can't be upgraded because DlHasParentGroups [string]$SectionTitle = "Validating Distribution Group Parent Membership" [string]$Description = "Checking if Distribution Group can't be upgraded because it is a child group of another parent group" @@ -216,10 +167,12 @@ catch { #I've commented write-log functions under try to remove enter spaces cursors when quering members inside each DL $parentdgcount=1 +$DGcounter=0 foreach($parentdg in $alldgs) { + $DGcounter++ try { - write-host "" + write-host "Processing $DGcounter group out from $($alldgs.count)" -ForegroundColor Cyan $Pmembers = Get-DistributionGroupMember $($parentdg.Guid.ToString()) -ErrorAction Stop #$CurrentProperty = "Retrieving: $parentdg members" #$CurrentDescription = "Success" @@ -255,7 +208,6 @@ else { #region Check if Distribution Group can't be upgraded because DlHasNonSupportedMemberTypes with RecipientTypeDetails other than UserMailbox, SharedMailbox, TeamMailbox, MailUser [string]$SectionTitle = "Validating Distribution Group Members Recipient Types" [string]$Description = "Checking if Distribution Group can't be upgraded because DL contains member RecipientTypeDetails other than UserMailbox, SharedMailbox, TeamMailbox, MailUser" -#$ConditionDGmembers=New-Object psobject try { $members = Get-DistributionGroupMember $($dg.Guid.ToString()) -ErrorAction stop $CurrentProperty = "Retrieving: $dgsmtp members" From 68bae434f5147adb723393c3b810c5ad2a5a96fa Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Sun, 31 Oct 2021 14:46:45 +0200 Subject: [PATCH 04/10] add write-progress in DLhasparentgroups --- .../Start-DlToO365GroupUpgradeChecks.ps1 | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index 7d42a9d..a8ce0ab 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -172,7 +172,9 @@ foreach($parentdg in $alldgs) { $DGcounter++ try { - write-host "Processing $DGcounter group out from $($alldgs.count)" -ForegroundColor Cyan + $DGcounter++ + $percent=[Int32]($DGcounter/$alldgs.count*100) + Write-Progress -Activity "Processing DGs" -PercentComplete $percent -Status "Processing $DGcounter/$($alldgs.count)group" -CurrentOperation OuterLoop $Pmembers = Get-DistributionGroupMember $($parentdg.Guid.ToString()) -ErrorAction Stop #$CurrentProperty = "Retrieving: $parentdg members" #$CurrentDescription = "Success" @@ -183,15 +185,25 @@ foreach($parentdg in $alldgs) $CurrentDescription = "Failure" write-log -Function "Retrieve Distribution Group membership" -Step $CurrentProperty -Description $CurrentDescription } - +$DGmembercounter=0 foreach ($member in $Pmembers) -{if ($member.alias -like $dg.alias) { - $ConditionParentDG+=$parentdg - $parentdgcount++ -} -} + if ($Pmembers.count -ge 1) + { + $DGmembercounter++ + $childpercent=[Int32]($DGmembercounter/$Pmembers.count*100) + Write-Progress -Activity "Processing members" -Id 1 -PercentComplete $childpercent -Status "Processing $DGmembercounter/$($Pmembers.count) member" -CurrentOperation InnerLoop + if ($member.alias -like $dg.alias) + { + $ConditionParentDG+=$parentdg + $parentdgcount++ + } + } + } + } +Write-Progress -Activity "Processing members" -Completed -id 1 +Write-Progress -Activity "Processing DGs" -Completed if($parentdgcount -le 1) { [String]$NoParentDG="Distribution group is NOT a member of another group" From e5e24c824053f7667cbda7c52e2a6b485c6756f2 Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Mon, 1 Nov 2021 13:23:58 +0200 Subject: [PATCH 05/10] add final block for write-progress fucntion --- .../Start-DlToO365GroupUpgradeChecks.ps1 | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index a8ce0ab..eb7d9ef 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -172,35 +172,36 @@ foreach($parentdg in $alldgs) { $DGcounter++ try { - $DGcounter++ - $percent=[Int32]($DGcounter/$alldgs.count*100) - Write-Progress -Activity "Processing DGs" -PercentComplete $percent -Status "Processing $DGcounter/$($alldgs.count)group" -CurrentOperation OuterLoop - $Pmembers = Get-DistributionGroupMember $($parentdg.Guid.ToString()) -ErrorAction Stop + $DistributionGroupMembers = Get-DistributionGroupMember $($parentdg.Guid.ToString()) -ErrorAction Stop #$CurrentProperty = "Retrieving: $parentdg members" #$CurrentDescription = "Success" #write-log -Function "Retrieve Distribution Group membership" -Step $CurrentProperty -Description $CurrentDescription + if($alldgs.count -ge 2) + { + $DGcounter++ + $percent=[Int32]($DGcounter/$alldgs.count*100) + Write-Progress -Activity "Processing DGs" -PercentComplete $percent -Status "Processing $DGcounter/$($alldgs.count)group" -CurrentOperation OuterLoop + } } catch { $CurrentProperty = "Retrieving: $parentdg members" $CurrentDescription = "Failure" write-log -Function "Retrieve Distribution Group membership" -Step $CurrentProperty -Description $CurrentDescription } -$DGmembercounter=0 -foreach ($member in $Pmembers) -{ - if ($Pmembers.count -ge 1) + $DGmembercounter=0 + foreach($DistributionGroupMember in $DistributionGroupMembers) + { + if ($DistributionGroupMember.Alias -like $dg.Alias) { - $DGmembercounter++ - $childpercent=[Int32]($DGmembercounter/$Pmembers.count*100) - Write-Progress -Activity "Processing members" -Id 1 -PercentComplete $childpercent -Status "Processing $DGmembercounter/$($Pmembers.count) member" -CurrentOperation InnerLoop - if ($member.alias -like $dg.alias) - { - $ConditionParentDG+=$parentdg - $parentdgcount++ - } + $parentdgcount++ + $ConditionParentDG=$ConditionParentDG+$parentdg } + if ($DistributionGroupMembers.count -ge 2) { + $DGmembercounter++ + $childpercent=[Int32]($DGmembercounter/$DistributionGroupMembers.count*100) + Write-Progress -Activity "Processing members" -Id 1 -PercentComplete $childpercent -Status "Processing $DGmembercounter/$($DistributionGroupMembers.count) member" -CurrentOperation InnerLoop + } } - } Write-Progress -Activity "Processing members" -Completed -id 1 Write-Progress -Activity "Processing DGs" -Completed From 58ad1a0277c0c9cb5adc1a2f622db4a73fa66b13 Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Mon, 1 Nov 2021 20:42:04 +0200 Subject: [PATCH 06/10] add write progress fucntion for shared mailbox cond --- .../Start-DlToO365GroupUpgradeChecks.ps1 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index eb7d9ef..d2d891d 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -180,7 +180,7 @@ foreach($parentdg in $alldgs) { $DGcounter++ $percent=[Int32]($DGcounter/$alldgs.count*100) - Write-Progress -Activity "Processing DGs" -PercentComplete $percent -Status "Processing $DGcounter/$($alldgs.count)group" -CurrentOperation OuterLoop + Write-Progress -Activity "Querying Distribution Groups" -PercentComplete $percent -Status "Processing $DGcounter/$($alldgs.count)group" } } catch { @@ -191,7 +191,7 @@ foreach($parentdg in $alldgs) $DGmembercounter=0 foreach($DistributionGroupMember in $DistributionGroupMembers) { - if ($DistributionGroupMember.Alias -like $dg.Alias) + if ($DistributionGroupMember.Alias -eq $dg.Alias) { $parentdgcount++ $ConditionParentDG=$ConditionParentDG+$parentdg @@ -199,12 +199,12 @@ foreach($parentdg in $alldgs) if ($DistributionGroupMembers.count -ge 2) { $DGmembercounter++ $childpercent=[Int32]($DGmembercounter/$DistributionGroupMembers.count*100) - Write-Progress -Activity "Processing members" -Id 1 -PercentComplete $childpercent -Status "Processing $DGmembercounter/$($DistributionGroupMembers.count) member" -CurrentOperation InnerLoop + Write-Progress -Activity "Querying Group Members" -Id 1 -PercentComplete $childpercent -Status "Processing $DGmembercounter/$($DistributionGroupMembers.count) member" } } } -Write-Progress -Activity "Processing members" -Completed -id 1 -Write-Progress -Activity "Processing DGs" -Completed +Write-Progress -Activity "Querying Group Members" -Completed -Id 1 +Write-Progress -Activity "Querying Distribution Groups" -Completed if($parentdgcount -le 1) { [String]$NoParentDG="Distribution group is NOT a member of another group" @@ -391,6 +391,7 @@ catch { write-log -Function "Retrieve Shared Mailboxes" -Step $CurrentProperty -Description $CurrentDescription } $counter=1 +$Sharedcounter=0 foreach($sharedMBX in $sharedMBXs) { if ($sharedMBX.ForwardingAddress -eq $dg.name -or $sharedMBX.ForwardingSmtpAddress -eq $dg.PrimarySmtpAddress) @@ -398,7 +399,15 @@ foreach($sharedMBX in $sharedMBXs) $Conditionfwdmbx= $Conditionfwdmbx+$sharedMBX $counter++ } + if ($sharedMBXs.count -ge 2) + { + $Sharedcounter++ + $percent=[Int32]($Sharedcounter/$sharedMBXs.count*100) + Write-Progress -Activity "Querying Shared Mailboxes" -PercentComplete $percent -Status "Processing $Sharedcounter/$($sharedMBXs.count) Mailboxes" + } + } +Write-Progress -Activity "Querying Shared Mailboxes" -Completed if ($counter -le 1) { $Nofwdmbxfound="Distribution group is NOT configured to be a forwarding address for any Shared Mailbox" [PSCustomObject]$ConditionfwdmbxHTML = New-ObjectForHTMLReport -SectionTitle $SectionTitle -SectionTitleColor "Green" -Description $Description -DataType "String" -EffectiveDataString $Nofwdmbxfound From d9ec35b88eaa9c7216293e4cada015489a3be7e0 Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Thu, 4 Nov 2021 16:25:56 +0200 Subject: [PATCH 07/10] add write progress on shared mailbox function --- .../Start-DlToO365GroupUpgradeChecks.ps1 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index d2d891d..b5f8266 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -153,6 +153,7 @@ else { [string]$Description = "Checking if Distribution Group can't be upgraded because it is a child group of another parent group" $ConditionParentDG=@() try { + Write-Host "Retrieving all distribution groups in Exchange online, please wait...." -ForegroundColor Yellow $alldgs=Get-DistributionGroup -ResultSize unlimited -ErrorAction Stop $CurrentProperty = "Retrieving All DGs in the EXO directory" $CurrentDescription = "Success" @@ -164,18 +165,12 @@ catch { $CurrentDescription = "Failure" write-log -Function "Retrieve All DGs" -Step $CurrentProperty -Description $CurrentDescription } - -#I've commented write-log functions under try to remove enter spaces cursors when quering members inside each DL $parentdgcount=1 $DGcounter=0 foreach($parentdg in $alldgs) { - $DGcounter++ try { $DistributionGroupMembers = Get-DistributionGroupMember $($parentdg.Guid.ToString()) -ErrorAction Stop - #$CurrentProperty = "Retrieving: $parentdg members" - #$CurrentDescription = "Success" - #write-log -Function "Retrieve Distribution Group membership" -Step $CurrentProperty -Description $CurrentDescription if($alldgs.count -ge 2) { $DGcounter++ @@ -222,6 +217,7 @@ else { [string]$SectionTitle = "Validating Distribution Group Members Recipient Types" [string]$Description = "Checking if Distribution Group can't be upgraded because DL contains member RecipientTypeDetails other than UserMailbox, SharedMailbox, TeamMailbox, MailUser" try { + Write-Host "Retrieving $dg.primarysmtpaddress members, please wait...." -ForegroundColor Yellow $members = Get-DistributionGroupMember $($dg.Guid.ToString()) -ErrorAction stop $CurrentProperty = "Retrieving: $dgsmtp members" $CurrentDescription = "Success" @@ -334,9 +330,16 @@ else { [string]$SectionTitle = "Validating Distribution Group Sender Restriction" [string]$Description = "Checking if Distribution Group can't be upgraded because the distribution list is part of Sender Restriction in another DL" $ConditionDGSender=@() +$DGcounterloop=0 [int]$SenderRestrictionCount=1 foreach($alldg in $alldgs) { + if($alldgs.count -ge 2) + { + $DGcounterloop++ + $perc=[Int32]($DGcounterloop/$alldgs.count*100) + Write-Progress -Activity "Querying Distribution Groups" -PercentComplete $perc -Status "Processing $DGcounterloop/$($alldgs.count)group" + } if ($alldg.AcceptMessagesOnlyFromSendersOrMembers -like $dg.Name -or $alldg.AcceptMessagesOnlyFromDLMembers -like $dg.Name ) { @@ -344,6 +347,7 @@ if ($alldg.AcceptMessagesOnlyFromSendersOrMembers -like $dg.Name -or $alldg.Acce $SenderRestrictionCount++ } } +Write-Progress -Activity "Querying Distribution Groups" -Completed if ($SenderRestrictionCount -le 1) { $NoDGSenderfound="Distribution group is NOT part of Sender Restriction in another group" [PSCustomObject]$ConditionDGSenderHTML = New-ObjectForHTMLReport -SectionTitle $SectionTitle -SectionTitleColor "Green" -Description $Description -DataType "String" -EffectiveDataString $NoDGSenderfound @@ -380,6 +384,7 @@ $Conditionfwdmbx=@() [string]$Description = "Checking if Distribution Group can't be upgraded because the distribution list is configured to be a forwarding address for Shared Mailbox" try { + Write-Host "Retrieving all shared mailboxes in Exchange online, please wait...." -ForegroundColor Yellow $sharedMBXs=Get-Mailbox -ResultSize unlimited -RecipientTypeDetails sharedmailbox -ErrorAction stop $CurrentProperty = "Retrieving All Shared MBXs in the EXO directory" $CurrentDescription = "Success" From 479709ffc1cefefdad4292e187c35d07159c1173 Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Sun, 7 Nov 2021 13:18:55 +0200 Subject: [PATCH 08/10] add info warnings to some checks --- ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index b5f8266..ea206c6 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -217,7 +217,7 @@ else { [string]$SectionTitle = "Validating Distribution Group Members Recipient Types" [string]$Description = "Checking if Distribution Group can't be upgraded because DL contains member RecipientTypeDetails other than UserMailbox, SharedMailbox, TeamMailbox, MailUser" try { - Write-Host "Retrieving $dg.primarysmtpaddress members, please wait...." -ForegroundColor Yellow + Write-Host "Retrieving $($dg.PrimarySmtpAddress) members, please wait...." -ForegroundColor Yellow $members = Get-DistributionGroupMember $($dg.Guid.ToString()) -ErrorAction stop $CurrentProperty = "Retrieving: $dgsmtp members" $CurrentDescription = "Success" @@ -430,6 +430,7 @@ $Conditiondupobj=@() [string]$SectionTitle = "Validating Distribution Group Duplicates" [string]$Description = "Checking if Distribution Group can't be upgraded because duplicate objects having same Alias,PrimarySmtpAddress,Name,DisplayName found" try { + Write-Host "Querying across Exchange online recipients for duplicate objects with $($dg.PrimarySmtpAddress) group, please wait..." -ForegroundColor Yellow $dupAlias=Get-Recipient -IncludeSoftDeletedRecipients -Identity $dg.alias -ResultSize unlimited -ErrorAction stop $dupAddress=Get-Recipient -IncludeSoftDeletedRecipients -ResultSize unlimited -Identity $dg.PrimarySmtpAddress -ErrorAction stop $dupDisplayName=Get-Recipient -IncludeSoftDeletedRecipients -ResultSize unlimited -Identity $dg.DisplayName -ErrorAction stop From 9659fa17ef530a0f1a928783560d6da4af63a65c Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Wed, 10 Nov 2021 15:22:56 +0200 Subject: [PATCH 09/10] modify name of Act. inside write progress function --- ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index ea206c6..57712e8 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -338,7 +338,7 @@ foreach($alldg in $alldgs) { $DGcounterloop++ $perc=[Int32]($DGcounterloop/$alldgs.count*100) - Write-Progress -Activity "Querying Distribution Groups" -PercentComplete $perc -Status "Processing $DGcounterloop/$($alldgs.count)group" + Write-Progress -Activity "Validating Distribution Groups Sender Restriction" -PercentComplete $perc -Status "Processing $DGcounterloop/$($alldgs.count)group" } if ($alldg.AcceptMessagesOnlyFromSendersOrMembers -like $dg.Name -or $alldg.AcceptMessagesOnlyFromDLMembers -like $dg.Name ) { @@ -347,7 +347,7 @@ if ($alldg.AcceptMessagesOnlyFromSendersOrMembers -like $dg.Name -or $alldg.Acce $SenderRestrictionCount++ } } -Write-Progress -Activity "Querying Distribution Groups" -Completed +Write-Progress -Activity "Validating Distribution Groups Sender Restriction" -Completed if ($SenderRestrictionCount -le 1) { $NoDGSenderfound="Distribution group is NOT part of Sender Restriction in another group" [PSCustomObject]$ConditionDGSenderHTML = New-ObjectForHTMLReport -SectionTitle $SectionTitle -SectionTitleColor "Green" -Description $Description -DataType "String" -EffectiveDataString $NoDGSenderfound From f04e0a6842a75f9ec277af7721dbf81bcd4e26cc Mon Sep 17 00:00:00 2001 From: hazemembaby <71065889+hazemembaby@users.noreply.github.com> Date: Mon, 15 Nov 2021 15:46:11 +0200 Subject: [PATCH 10/10] add -ResultSize unlimited to get functions --- ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 index 57712e8..78ba124 100644 --- a/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 +++ b/ActionPlans/Start-DlToO365GroupUpgradeChecks.ps1 @@ -48,7 +48,7 @@ mkdir $ExportPath -Force |out-null #region Getting the DG SMTP $dgsmtp=Get-ValidEmailAddress("Email address of the Distribution Group ") try { - $dg=get-DistributionGroup -Identity $dgsmtp -ErrorAction stop + $dg=get-DistributionGroup -Identity $dgsmtp -ErrorAction stop -ResultSize unlimited $CurrentProperty = "Retrieving: $dgsmtp object from EXO Directory" $CurrentDescription = "Success" write-log -Function "Retrieve Distribution Group Object From EXO Directory" -Step $CurrentProperty -Description $CurrentDescription @@ -170,7 +170,7 @@ $DGcounter=0 foreach($parentdg in $alldgs) { try { - $DistributionGroupMembers = Get-DistributionGroupMember $($parentdg.Guid.ToString()) -ErrorAction Stop + $DistributionGroupMembers = Get-DistributionGroupMember $($parentdg.Guid.ToString()) -ErrorAction Stop -ResultSize unlimited if($alldgs.count -ge 2) { $DGcounter++ @@ -218,7 +218,7 @@ else { [string]$Description = "Checking if Distribution Group can't be upgraded because DL contains member RecipientTypeDetails other than UserMailbox, SharedMailbox, TeamMailbox, MailUser" try { Write-Host "Retrieving $($dg.PrimarySmtpAddress) members, please wait...." -ForegroundColor Yellow - $members = Get-DistributionGroupMember $($dg.Guid.ToString()) -ErrorAction stop + $members = Get-DistributionGroupMember $($dg.Guid.ToString()) -ErrorAction stop -ResultSize unlimited $CurrentProperty = "Retrieving: $dgsmtp members" $CurrentDescription = "Success" write-log -Function "Retrieve Distribution Group membership" -Step $CurrentProperty -Description $CurrentDescription @@ -291,7 +291,7 @@ if ($checkifownerhasmailbox -match "Continuechecking") foreach($owner in $owners) { try { - $owner=Get-Recipient $owner -ErrorAction stop + $owner=Get-Recipient $owner -ErrorAction stop -ResultSize unlimited if (!($owner.RecipientTypeDetails -eq "UserMailbox" -or $owner.RecipientTypeDetails -eq "MailUser")) { $ConditionDGownernonsupported=$ConditionDGownernonsupported+$owner @@ -302,7 +302,7 @@ if ($checkifownerhasmailbox -match "Continuechecking") $CurrentDescription = "Failure" write-log -Function "Validate owner RecipientTypeDetails" -Step $CurrentProperty -Description $CurrentDescription #check if the owner RecipientTypeDetails is User - $owner=Get-User $owner -ErrorAction stop + $owner=Get-User $owner -ErrorAction stop -ResultSize unlimited $ConditionDGownernonsupportedforusers=$ConditionDGownernonsupportedforusers+$owner } }