Skip to content

Get-EXOMailboxPermission

Exchange Online Management: Gets permissions on a mailbox

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$Identity,
    [switch]$Owner,
    [switch]$SoftDeletedMailbox,
    [int]$ResultSize = 1000
)

Process {
    try {
        [hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'ResultSize' = $ResultSize; 'Owner' = $Owner; 'Identity' = $Identity; 'SoftDeletedMailbox' = $SoftDeletedMailbox}

        $result = Get-EXOMailboxPermission @cmdArgs
        if ($null -eq $result -or $result.Count -eq 0) {
            Write-Output "No mailbox permissions found"
            return
        }
        foreach ($item in $result) {
            $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force
        }
    }
    catch { throw }
}

Name, Alias or SamAccountName of the mailbox

Off

Returns the owner information for the mailbox

Off

Return soft-deleted mailboxes in the results

Maximum number of results to return

An interactive directory of PowerShell scripts.