我正在尝试从O365 / Exchange在线中的所有客户域中检索列表。
当前,我正在使用此脚本检索所有邮箱大小的列表:
$credential = Get-Credential
connect-msolservice -Credential $credential
$clients = Get-MsolPartnerContract -All
foreach ($client in $clients) {
$ClientDomain = Get-MsolDomain -TenantId $client.TenantId | Where-Object {$_.IsInitial -eq $true}
Write-host "Logging into portal for $($client.Name)"
$DelegatedOrgURL = "https://ps.outlook.com/powershell-liveid?DelegatedOrg=" + $ClientDomain.Name
$ExchangeOnlineSession = New-PSSession -ConnectionUri $DelegatedOrgURL -Credential $credential
-Authentication Basic -ConfigurationName Microsoft.Exchange -AllowRedirection
Import-PSSession -Session $ExchangeOnlineSession -AllowClobber -DisableNameChecking
Get-Mailbox | Get-MailboxStatistics | Select-Object DisplayName, IsArchiveMailbox, ItemCount,
TotalItemSize | format-table
Remove-PSSession $ExchangeOnlineSession
}
我尝试合并
Get-MxRecordReport -Domain "contoso.com"
或
Get-AzureADDomainServiceConfigurationRecord -Name domain.com | ? {$_.RecordType -eq "Mx"} |
select MailExchange
但是我似乎无法为所有客户域的MX记录生成一个不错的列表。 任何建议将不胜感激。