使用Exchange命令行管理程序从Exchange 2010导出所有用户免责声明

时间:2015-11-22 08:10:27

标签: powershell export exchange-server exchange-management-shell

我需要使用Exchange命令行管理程序从Exchange 2010导出用户免责声明。那可能吗?免责声明的例子:

Kathleen Mayer
Sales Department
Contoso
www.contoso.com
kathleen@contoso.com
cell: 111-222-1234

我尝试过这个脚本,但其结果并没有包含免责声明:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

try {
    Import-Module ActiveDirectory -ErrorAction Stop
}
catch {
    Write-Host "Unable to load Active Directory module, is RSAT installed?"
    Exit
}

$Results = foreach ($User in (Get-ADUser -Filter * -Properties Department, Mail)) {

    $Mailbox = Get-Mailbox $User.Name -ErrorAction SilentlyContinue

    if ($Mailbox) {
        $Mail = $Mailbox | Get-MailboxStatistics -ErrorAction SilentlyContinue

        if ($Mail.TotalItemSize.Value -eq $null) {
            $TotalSize = 0
        } else {
            $TotalSize = $Mail.TotalItemSize.Value.ToBytes()
        }

        New-Object PSObject -Property @{
            Name = $User.Name
            SamAccountName = $User.SamAccountName
            Email = $User.Mail
            Department = $User.Department
            MailboxSize = $TotalSize
            IssueWarningQuota = $Mailbox.IssueWarningQuota
            ProhibitSendQuota = $Mailbox.ProhibitSendQuota
            ProhibitSendReceiveQuota = $Mailbox.ProhibitSendReceiveQuota
        }
    }
}

$Results |
    Select Name, SamAccountName, Email, `
    Department, MailboxSize, IssueWarningQuota, `
    ProhibitSendQuota, ProhibitSendReceiveQuota |
    Export-Csv c:\MailboxSizeByDepartment.csv -NoTypeInformation

请参阅此链接:https://technet.microsoft.com/en-us/library/dn600437%28v=exchg.150%29.aspx

0 个答案:

没有答案