Repository: microsoft/CSS-Exchange
File: Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 (PowerShell)

Code before:
        [string]$Organization
    )

    try {
        Write-Verbose "Searching Get-Mailbox $(if ($Organization -ne `"`" ) {"with Org: $Organization"}) for $Identity."

        if ($Identity -and $Organization) {
            if ($script:MSSupport) {
                Write-Verbose  "Using Organization parameter"
                $GetMailboxOutput = Get-Mailbox -Identity $Identity -Organization $Organization  -ErrorAction SilentlyContinue;
            } else {
                Write-Verbose  "Using -OrganizationalUnit parameter"
                $GetMailboxOutput = Get-Mailbox -Identity $Identity -OrganizationalUnit $Organization  -ErrorAction SilentlyContinue;
            }
        } else {
            $GetMailboxOutput = Get-Mailbox -Identity $Identity -ErrorAction SilentlyContinue;
        }

        if (!$GetMailboxOutput) {
            Write-Host "Unable to find [$Identity]$(if ($Organization -ne `"`" ) {" in Organization:[$Organization]"})."
            Write-Host "Trying to find a Group Mailbox for [$Identity]..."
            $GetMailboxOutput = Get-Mailbox -Identity $Identity -ErrorAction SilentlyContinue -GroupMailbox;
            if (!$GetMailboxOutput) {
                Write-Host "Unable to find a Group Mailbox for [$Identity] either."
                return $null
            } else {
                Write-Verbose "Found GroupMailbox [$($GetMailboxOutput.DisplayName)]"
            }
        } else {
            Write-Verbose "Found [$($GetMailboxOutput.DisplayName)]"
        }

        if (CheckForNoPIIAccess($script:GetMailboxOutput.DisplayName)) {
            Write-Host -ForegroundColor Magenta "No PII Access for [$Identity]"
        } else {
            Write-Verbose "Found [$($GetMailboxOutput.DisplayName)]"
        }
        return $GetMailboxOutput;
    } catch {
        Write-Error "An error occurred while running Get-Mailbox: [$_]";
    }
}

function Convert-Data {
    param(
        [Parameter(Mandatory = $True)]
        [string[]] $ArrayNames,
        [switch ] $NoWarnings = $False
    )
    $ValidArrays = @();
    $ItemCounts = @();

Review comment (suggestion):
Recommend doing `-not ([string]::IsNullOrEmpty($Organization))` instead of only checking for an empty string. 

Code after:
.PARAMETER Organization
    [Optional] Organization to search for the mailbox in.
#>
function GetMailbox {
    param(
        [string]$Identity,
        [string]$Organization
    )

    try {
        Write-Verbose "Searching Get-Mailbox $(if (-not ([string]::IsNullOrEmpty($Organization))) {"with Org: $Organization"}) for $Identity."

        if ($Identity -and $Organization) {
            if ($script:MSSupport) {
                Write-Verbose "Using Organization parameter"
                $GetMailboxOutput = Get-Mailbox -Identity $Identity -Organization $Organization -ErrorAction SilentlyContinue;
            } else {
                Write-Verbose "Using -OrganizationalUnit parameter"
                $GetMailboxOutput = Get-Mailbox -Identity $Identity -OrganizationalUnit $Organization -ErrorAction SilentlyContinue;
            }
        } else {
            $GetMailboxOutput = Get-Mailbox -Identity $Identity -ErrorAction SilentlyContinue;
        }

        if (!$GetMailboxOutput) {
            Write-Host "Unable to find [$Identity]$(if ($Organization -ne `"`" ) {" in Organization:[$Organization]"})."
            Write-Host "Trying to find a Group Mailbox for [$Identity]..."
            $GetMailboxOutput = Get-Mailbox -Identity $Identity -ErrorAction SilentlyContinue -GroupMailbox;
            if (!$GetMailboxOutput) {
                Write-Host "Unable to find a Group Mailbox for [$Identity] either."
                return $null
            } else {
                Write-Verbose "Found GroupMailbox [$($GetMailboxOutput.DisplayName)]"
            }
        } else {
            Write-Verbose "Found [$($GetMailboxOutput.DisplayName)]"
        }

        if (CheckForNoPIIAccess($script:GetMailboxOutput.DisplayName)) {
            Write-Host -ForegroundColor Magenta "No PII Access for [$Identity]"
        } else {
            Write-Verbose "Found [$($GetMailboxOutput.DisplayName)]"
        }
        return $GetMailboxOutput;
    } catch {
        Write-Error "An error occurred while running Get-Mailbox: [$_]";
    }
}

function Convert-Data {
    param(