Public/Get-AllClientMailboxForwarding.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function Get-AllClientMailboxForwarding {
    [cmdletbinding()]
    param()

    begin {
        $contracts = Get-MsolPartnerContract
    }

    process {
        foreach ($contract in $contracts) {
            Write-Verbose "Getting mailboxes and forwarding information for $($contract.name)"
            $forwards = Get-MailboxFowarding | Select-Object -Property @{n = 'ClientName'; e = { $contract.Name } }, *
            $forwards
        }
    }
}