Forum Discussion
Tlu01
Jul 07, 2021Copper Contributor
How to pipe a result from one command to another for Office 365 powershell
I need to show the name of users with full permission access to a shared mailbox. I found the script to export the user list, however it only shows the user ID in O365, not the Display name. I foun...
- Jul 07, 2021No need to do this in multiple steps, you can use PowerShell's "calculated property" feature:
Get-MailboxPermission shared “Shared mailbox” | Where-Object { ($_.IsInherited -eq $False) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | select User,@{n="DisplayName";e={(Get-Recipient $_.User).displayName}} | Export-Csv "sharedmailbox.csv" -nti
VasilMichev
Jul 07, 2021MVP
No need to do this in multiple steps, you can use PowerShell's "calculated property" feature:
Get-MailboxPermission shared “Shared mailbox” | Where-Object { ($_.IsInherited -eq $False) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | select User,@{n="DisplayName";e={(Get-Recipient $_.User).displayName}} | Export-Csv "sharedmailbox.csv" -nti
Get-MailboxPermission shared “Shared mailbox” | Where-Object { ($_.IsInherited -eq $False) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | select User,@{n="DisplayName";e={(Get-Recipient $_.User).displayName}} | Export-Csv "sharedmailbox.csv" -nti
Tlu01
Jul 07, 2021Copper Contributor
Thanks, Vasil.
Still learning about PowerShell scripts.
I did have to remove the shared in the script for it to work.
Get-MailboxPermission “Shared mailbox” | Where-Object { ($_.IsInherited -eq $False) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | select User,@{n="DisplayName";e={(Get-Recipient $_.User).displayName}} | Export-Csv "sharedmailbox.csv" -nti
Still learning about PowerShell scripts.
I did have to remove the shared in the script for it to work.
Get-MailboxPermission “Shared mailbox” | Where-Object { ($_.IsInherited -eq $False) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | select User,@{n="DisplayName";e={(Get-Recipient $_.User).displayName}} | Export-Csv "sharedmailbox.csv" -nti