August 22

How to use Powershell to Export All Distribution Groups and Members to CSV

Create a temp fold at c:\ called c:\temp and run the following script


$Groups = Get-DistributionGroup
$Groups | ForEach-Object {
$group = $_.Name
$members = ''
Get-DistributionGroupMember $group | ForEach-Object {
        If($members) {
              $members=$members + ";" + $_.Name
           } Else {
              $members=$_.Name
           }
  }
New-Object -TypeName PSObject -Property @{
      GroupName = $group
      Members = $members
     }
} | Export-CSV "C:\temp\Distribution-Group-and-Members.csv" -NoTypeInformation -Encoding UTF8
August 3

How to list all mailboxes that an Exchange online user has access?

Connect to Exchange Online PowerShell

Run powershell with elevated privileges

1. Connect-ExchangeOnline

2. List all mailboxes to which a user has Send As permissions:

PS C:\> Get-Mailbox | Get-RecipientPermission -Trustee Katy

3. List all mailboxes to which a particular user has Full Access permissions:

PS C:\> Get-Mailbox | Get-MailboxPermission -User Katy

4. List all mailboxes to which a particular security principal has Send on behalf of permissions:

PS C:\> Get-Mailbox | ? {$_.GrantSendOnBehalfTo -match “katy”}