obtener_miembros_de_cada_buzon_compartido_de_exchange
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| obtener_miembros_de_cada_buzon_compartido_de_exchange [2023/05/17 15:51] – created oso | obtener_miembros_de_cada_buzon_compartido_de_exchange [2024/10/17 21:42] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Q: I need to get the members of a list of Exchange groups (distribution groups and shared inboxes). ===== | ||
| + | |||
| + | |||
| You can use PowerShell and the Microsoft 365 Exchange Online PowerShell module to retrieve the members of Exchange groups in your Microsoft 365 tenant. Here's an example script that reads a list of group names from a text file and exports the group members to a CSV file: | You can use PowerShell and the Microsoft 365 Exchange Online PowerShell module to retrieve the members of Exchange groups in your Microsoft 365 tenant. Here's an example script that reads a list of group names from a text file and exports the group members to a CSV file: | ||
| Line 35: | Line 38: | ||
| Please note that you'll need to have the necessary administrative rights and permissions to execute these commands in your Microsoft 365 tenant. | Please note that you'll need to have the necessary administrative rights and permissions to execute these commands in your Microsoft 365 tenant. | ||
| - | ===== Obtener el tipo de cuenta ===== | + | ===== Obtener el tipo de cuenta |
| Line 86: | Line 89: | ||
| The script connects to Exchange Online, reads the email addresses from the text file, and then iterates through each email address. It checks if the address belongs to a mailbox using the `Get-Mailbox` cmdlet and if it belongs to a distribution group using the `Get-DistributionGroup` cmd | The script connects to Exchange Online, reads the email addresses from the text file, and then iterates through each email address. It checks if the address belongs to a mailbox using the `Get-Mailbox` cmdlet and if it belongs to a distribution group using the `Get-DistributionGroup` cmd | ||
| - | ===== Exportar buzones compartidos ===== | + | ===== Exportar buzones compartidos |
| Line 135: | Line 138: | ||
| Please give this updated script a try, and it should provide you with the membership details of the Shared Mailboxes listed in the text file. | Please give this updated script a try, and it should provide you with the membership details of the Shared Mailboxes listed in the text file. | ||
| - | ==== En vez de User es Trustee ==== | + | ==== Q: The only correction I had to do: instead of " |
| Line 141: | Line 144: | ||
| I'm glad to hear that the rest of the script worked flawlessly for you. If you have any more questions or need further assistance, feel free to ask. | I'm glad to hear that the rest of the script worked flawlessly for you. If you have any more questions or need further assistance, feel free to ask. | ||
| + | |||
| + | ==== Q: What is the purpose of " | ||
| + | |||
| The purpose of the `Where-Object` filtering in the script is to retrieve only the mailbox permissions entries that meet specific criteria. Let's break down the filtering criteria used: | The purpose of the `Where-Object` filtering in the script is to retrieve only the mailbox permissions entries that meet specific criteria. Let's break down the filtering criteria used: | ||
| - | 1. `$_` represents the current pipeline object, which in this case is each mailbox permission entry. | + | - 1. `$_` represents the current pipeline object, which in this case is each mailbox permission entry. |
| - | 2. `AccessRights -contains " | + | |
| - | 3. `IsInherited -eq $false` checks if the permission is not inherited from a parent object. This excludes any permissions inherited from higher-level groups or objects, and only includes direct permissions set on the mailbox. | + | |
| By combining these criteria, the script filters out any mailbox permissions that are not directly assigned and do not have FullAccess. This helps to ensure that only relevant mailbox permissions are included in the final result. | By combining these criteria, the script filters out any mailbox permissions that are not directly assigned and do not have FullAccess. This helps to ensure that only relevant mailbox permissions are included in the final result. | ||
| Line 152: | Line 158: | ||
| If you have specific requirements for filtering the mailbox permissions, | If you have specific requirements for filtering the mailbox permissions, | ||
| - | ===== Versión 2 ===== | + | ===== Q: Look, it would be great if the output file stores the pair of addresses: " |
| Certainly! Here's the modified script that includes the pair of addresses " | Certainly! Here's the modified script that includes the pair of addresses " | ||
| Line 201: | Line 207: | ||
| $result | Export-Csv -Path " | $result | Export-Csv -Path " | ||
| + | </ | ||
| + | |||
| + | ====== Obtener listas de SharedMailboxes y Listas de distribución en un .csv cada una ====== | ||
| + | |||
| + | |||
| + | <code powershell: getMailboxes.ps1> | ||
| + | |||
| + | $mailboxes = Get-Mailbox -RecipientTypeDetails SharedMailbox | ||
| + | |||
| + | $result = foreach ($mailbox in $mailboxes) { | ||
| + | $permissions = Get-MailboxPermission -Identity $mailbox.Identity | ||
| + | |||
| + | foreach ($permission in $permissions) { | ||
| + | [PSCustomObject]@{ | ||
| + | SharedMailbox = $mailbox.PrimarySmtpAddress | ||
| + | Trustee = $permission.User | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | $result | Export-Csv -Path " | ||
| + | |||
| + | $distributionLists = Get-DistributionGroup | ||
| + | |||
| + | $result = foreach ($distributionList in $distributionLists) { | ||
| + | $groupMembers = Get-DistributionGroupMember -Identity $distributionList.Identity | ||
| + | |||
| + | foreach ($member in $groupMembers) { | ||
| + | [PSCustomObject]@{ | ||
| + | DistributionList = $distributionList.PrimarySmtpAddress | ||
| + | Member = $member.Name | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | $result | Export-Csv -Path " | ||
| </ | </ | ||
obtener_miembros_de_cada_buzon_compartido_de_exchange.1684338687.txt.gz · Last modified: 2024/10/17 21:42 (external edit)
