Repository: microsoft/CSS-Exchange
File: PublicFolders/ValidateEXOPFDumpster.ps1 (PowerShell)

Code before:
}
function AskForFeedback {
    Write-Host "Please rate the script experience & tell us what you liked or what we can do better over https://aka.ms/PFDumpsterFeedback!" -ForegroundColor Cyan
    "Please rate the script experience & tell us what you liked or what we can do better over https://aka.ms/PFDumpsterFeedback!" | Out-File $ExportPath\$Script:ReportName -Append
}
function QuitEXOSession {
    if ($null -eq $SessionCheck) {
        try {
            Write-Host "Quitting EXO PowerShell session..." -ForegroundColor Yellow
            Disconnect-ExchangeOnline -ErrorAction Stop -Confirm:$false
            $CurrentDescription= "Disconnecting from EXO"
            $CurrentStatus = "Success"
            LogError -CurrentStatus $CurrentStatus -Function "Disconnecting from EXO" -CurrentDescription $CurrentDescription
            Write-Host "`nOutput was exported in the following location: $ExportPath" -ForegroundColor Yellow
            Start-Sleep -Seconds 3
            break
        } catch {
            $ErrorEncountered=$Global:error[0].Exception
            $CurrentDescription = "Disconnecting from EXO"
            $CurrentStatus = "Failure"
            LogError -CurrentStatus $CurrentStatus -Function "Disconnecting from EXO" -CurrentDescription $CurrentDescription
            Write-Host "Error encountered during executing the script!"-ForegroundColor Red
            Write-Host $ErrorEncountered -ForegroundColor Red
            Write-Host "`nOutput was exported in the following location: $ExportPath" -ForegroundColor Yellow
            Start-Sleep -Seconds 3
            break
        }
    }
}
#Intro
$ts = Get-Date -Format yyyyMMdd_HHmmss
Write-Host $ExportPath
if ($null -eq $ExportPath -or $ExportPath -eq "") {
    $ExportPath = "$env:USERPROFILE\Desktop\ValidatePFDumpster\ValidatePFDumpster_$ts"
    mkdir $ExportPath -Force | Out-Null
} else {
    if (!(Test-Path -Path $ExportPath)) {
        Write-Host "The specified folder location $ExportPath is not existing, please re-run the script and ensure to enter a valid path or leave the ExportPath unassigned" -ForegroundColor Red
        exit
    } else {
        $ExportPath = "$ExportPath\ValidatePFDumpster\ValidatePFDumpster_$ts"
        mkdir $ExportPath -Force | Out-Null
    }
}
[string]$Description = "This script illustrates issues related to deleting public folder items or removing the public folder on PublicFolder $PFolder, BLOCKERS will be reported down, please ensure to mitigate them!`n"
Write-Host $Description -ForegroundColor Cyan
$Description | Out-File $ExportPath\$Script:ReportName -Append
#Connect to EXO PS
$SessionCheck = Get-PSSession | Where-Object { $_.Name -like "*ExchangeOnline*" -and $_.State -match "opened" }
if ($null -eq $SessionCheck) {
    Connect2EXO

Review comment (suggestion):
Not sure what the intent of this `break` is here, but this isn't correct use of it. 

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_break?view=powershell-7.3#do-not-use-break-outside-of-a-loop-switch-or-trap

Code after:
    $PublicFolderInfo | Export-Clixml -Path "$ExportPath\logs_$ts\PublicFolderInfo$($PublicFolderInfo.PublicFolder.Name).xml"
}
function AskForFeedback {
    $Feedback="Please rate the script experience & tell us what you liked or what we can do better over https://aka.ms/PFDumpsterFeedback!"
    Write-Host $Feedback -ForegroundColor Cyan
    $Feedback | Out-File $ExportPath\$Script:ReportName -Append
}
function QuitEXOSession {
    if ($null -eq $SessionCheck) {
        try {
            Write-Host "Quitting EXO PowerShell session..." -ForegroundColor Yellow
            Disconnect-ExchangeOnline -ErrorAction Stop -Confirm:$false
            $CurrentDescription= "Disconnecting from EXO"
            $CurrentStatus = "Success"
            LogError -CurrentStatus $CurrentStatus -Function "Disconnecting from EXO" -CurrentDescription $CurrentDescription
            Write-Host "`nOutput was exported in the following location: $ExportPath" -ForegroundColor Yellow
            Start-Sleep -Seconds 3
            exit
        } catch {
            $ErrorEncountered=$Global:error[0].Exception
            $CurrentDescription = "Disconnecting from EXO"
            $CurrentStatus = "Failure"
            LogError -CurrentStatus $CurrentStatus -Function "Disconnecting from EXO" -CurrentDescription $CurrentDescription
            Write-Host "Error encountered during executing the script!"-ForegroundColor Red
            Write-Host $ErrorEncountered -ForegroundColor Red
            Write-Host "`nOutput was exported in the following location: $ExportPath" -ForegroundColor Yellow
            Start-Sleep -Seconds 3
            exit
        }
    }
}
#Intro
$ts = Get-Date -Format yyyyMMdd_HHmmss
Write-Host $ExportPath
if ($null -eq $ExportPath -or $ExportPath -eq "") {
    $ExportPath = "$env:USERPROFILE\Desktop\ValidatePFDumpster\ValidatePFDumpster_$ts"
    mkdir $ExportPath -Force | Out-Null
} else {
    if (!(Test-Path -Path $ExportPath)) {
        Write-Host "The specified folder location $ExportPath is not existing, please re-run the script and ensure to enter a valid path or leave the ExportPath unassigned" -ForegroundColor Red
        exit
    } else {
        $ExportPath = "$ExportPath\ValidatePFDumpster\ValidatePFDumpster_$ts"
        mkdir $ExportPath -Force | Out-Null
    }
}
[string]$Description = "This script illustrates issues related to deleting public folder items or removing the public folder on PublicFolder $PFolder, BLOCKERS will be reported down, please ensure to mitigate them!`n"
Write-Host $Description -ForegroundColor Cyan
$Description | Out-File $ExportPath\$Script:ReportName -Append
#Connect to EXO PS
$SessionCheck = Get-PSSession | Where-Object { $_.Name -like "*ExchangeOnline*" -and $_.State -match "opened" }