mirror of
https://github.com/admindroid-community/powershell-scripts.git
synced 2025-12-17 16:35:19 +00:00
List All Mailboxes a User can Access
List All Mailboxes a User can Access
This commit is contained in:
parent
57457c1d94
commit
318020851a
@ -48,7 +48,7 @@ function Connect_Exo {
|
||||
Write-Host "ExchangeOnline PowerShell module is connected successfully"
|
||||
}
|
||||
function FullAccess {
|
||||
$MB_FullAccess = $global:Mailbox | Get-MailboxPermission -User $UPN -ErrorAction Stop | Select-Object Identity
|
||||
$MB_FullAccess = $global:Mailbox | Get-MailboxPermission -User $UPN -ErrorAction SilentlyContinue | Select-Object Identity
|
||||
if ($MB_FullAccess.count -ne 0) {
|
||||
$ExportResult = @{'User Name' = $Identity; 'AccessType' = "Full Access"; 'Delegated Mailbox Name' = $MB_FullAccess.Identity -join (",") }
|
||||
}
|
||||
@ -59,7 +59,7 @@ function FullAccess {
|
||||
$ExportResults | Select-object 'User Name', 'AccessType', 'Delegated Mailbox Name' | Export-csv -path $global:ExportCSVFileName -NoType -Append -Force
|
||||
}
|
||||
function SendAs {
|
||||
$MB_SendAs = Get-RecipientPermission -Trustee $UPN -ErrorAction Stop | Select-Object Identity
|
||||
$MB_SendAs = Get-RecipientPermission -Trustee $UPN -ErrorAction SilentlyContinue | Select-Object Identity
|
||||
if ($MB_SendAs.count -ne 0) {
|
||||
$ExportResult = @{'User Name' = $Identity; 'AccessType' = "Send As"; 'Delegated Mailbox Name' = $MB_SendAs.Identity -join (",") }
|
||||
}
|
||||
@ -71,7 +71,7 @@ function SendAs {
|
||||
|
||||
}
|
||||
function SendOnBehalfTo {
|
||||
$MB_SendOnBehalfTo = $global:Mailbox | Where-Object { $_.GrantSendOnBehalfTo -match $Identity } -ErrorAction Stop | Select-Object Name
|
||||
$MB_SendOnBehalfTo = $global:Mailbox | Where-Object { $_.GrantSendOnBehalfTo -match $Identity } -ErrorAction SilentlyContinue | Select-Object Name
|
||||
if ($MB_SendOnBehalfTo.count -ne 0) {
|
||||
$ExportResult = @{'User Name' = $Identity; 'AccessType' = "Send on Behalf"; 'Delegated Mailbox Name' = $MB_SendOnBehalfTo.Name -join (",") }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user