Skip to content
KBHost
Menu
216.73.216.188
KBHost
FileHost
Home
/
Knowledgebase
/
Office 365 & Azure
/
PowerShell & cmd
/
Snippets
/
List which mailboxes are shared with user
List which mailboxes are shared with user
1
0
Connect to Office 365 with PowerShell
Specific:
# Prompt the user to enter a username $Username = Read-Host "Enter the username to check mailbox permissions for" # Get all mailboxes $mailboxes = Get-Mailbox -ResultSize Unlimited # Iterate through each mailbox and check permissions for the specified user foreach ($mailbox in $mailboxes) { # Get the mailbox permissions for the specified user $permissions = Get-MailboxPermission -Identity $mailbox.Identity -User $Username -ErrorAction SilentlyContinue # If there are permissions for the user, display the mailbox and permissions if ($permissions) { Write-Output "Mailbox: $($mailbox.Identity)" $permissions | Format-Table -AutoSize } }
Get-Mailbox | Get-MailboxPermission -User Username
All:
Get-Mailbox -ResultSize Unlimited | ForEach-Object {Get-MailboxPermission -Identity $_.DistinguishedName | Select-Object Identity,User,AccessRights | Where-Object {($_.user -like '*@*')}} | Export-Csv C:\Permissions.csv -NoTypeInformation
Calendar:
$userToCheck = Read-Host -Prompt "Enter the username to search for (partial name is ok)" Get-Mailbox | ForEach-Object { $email = $_.PrimarySmtpAddress $displayName = $_.DisplayName Get-MailboxFolderPermission -Identity ($email + ":\Agenda") -ErrorAction SilentlyContinue | Select-Object @{Name='Owner';Expression={$displayName}}, User, AccessRights, FolderName Get-MailboxFolderPermission -Identity ($email + ":\Calendar") -ErrorAction SilentlyContinue | Select-Object @{Name='Owner';Expression={$displayName}}, User, AccessRights, FolderName } | Where-Object {$_.User -like "$userToCheck*"}
No sleep -
00:00
Password Generator
Most viewed
Connect to Office 365 with PowerShell
Silent update Microsoft Remote Desktop
Add Microsoft Photos app to Server 2019
Enable NFS client in Windows 10
Clear Outlook filter for all folders
Asus ZenWiFi LED color status
Ventoy Windows 11 To Go
Find and delete all snapshots
Most recent
Install or Update reMarkable
TrueNAS Clear failed jobs history
TrueNAS SSH Hetzner Storage Box Rsync
Print Screen from PowerShell
Create local user during Windows Setup
Force Microsoft 365 installation
Enable MailTips in Microsoft 365
Get Home Assistant Logs
We use cookies to ensure the best experience on our website. If you continue to use this site, we assume that you are happy with this.
Ok