关于Exchange Server 2010邮箱查询的一些命令

一.  查询邮箱数

1.    查询组织邮箱总数

Get-Mailbox | Measure-Object

2.    查询某个数据库或服务器数箱总数

Get-Mailbox –database dbname | Measure-Object

 

Get-Mailbox –Server servername | Measure-Object

 

二.  查询邮箱信息

1.    查询7天内创建的邮箱、并导出成一个TXT文件、导出成CSV文件

Get-Mailbox | Where-Object {$_.WhenCreated –ge ((Get-Date).Adddays(-7))}

Get-Mailbox | Where-Object {$_.WhenCreated –ge ((Get-Date).Adddays(-7))} | ft name, servername, database

Get-Mailbox | Where-Object {$_.WhenCreated –ge ((Get-Date).Adddays(-7))} | ft name, servername, database | Out-File C:\mailboxes.txt

Get-Mailbox | Where-Object {$_.WhenCreated –ge ((Get-Date).Adddays(-7))} | ft name, servername, database | Export-CSV c:\mailboxes.csv

2.    查询8月份创建的邮箱

Get-Mailbox | Where-Object {($_.WhenCreated).Month –eq 8} | ft name, servername, database

3.    查询2013年创建的邮箱

Get-Mailbox | Where-Object {($_.WhenCreated).Year –eq 2013} | ft name, servername, database

4.    查询具有Sender as(代理发送)和Full Access(完全访问)权限的邮箱

Get-Mailbox | Get-ADPermission | Where-Object { ($_.ExtendedRights -like “*send-as*”) -and -not ($_.User -like “nt authorityself”) }

Get-Mailbox | Get-ADPermission | Where-Object { ($_.ExtendedRights -like “*send-as*”) -and -not ($_.User -like “nt authorityself”) } | Select Identity, User

Get-Mailbox | Get-ADPermission | Where-Object { ($_.ExtendedRights -like “*send-as*”) -and -not ($_.User -like “nt authorityself”) } | Select Identity, User | Export-CSV c:sendas.cvs

Get-Mailbox | Get-MailboxPermission | Where-Object { ($_.AccessRights -eq “*fullaccess*”) -and ($_.IsInherited -eq $false) -and -not ($_.User -like “*nt authorityself*”) }

Get-Mailbox | Get-MailboxPermission | Where-Object { ($_.AccessRights -eq “*fullaccess*”) -and ($_.User -like “*5dmail*”) }

 

三.  查询邮箱统计信息

1.    查询邮箱最近100天登录过的邮箱

Get-MailboxStatistics | where {$_.LastLogonTime -lt (get-date).AddDays(-100)} | ft displayName,lastlogontime,lastloggedonuseraccount,servername

2.    查询从未登录过的邮箱

Get-MailboxStatistics -resultsize unlimited | where {$_.LastLogonTime -eq $null | ft displayName,lastlogontime,lastloggedonuseraccount,servername

 

四.  查询断开连接的邮箱

Get-MailboxStatistics | Where {$_.DisconnectDate -gt (get-date).AddDays(-14)} | ft displayName,ServerName,DatabaseName,TotalItemSize -Autosize

历史评论

暂无保留的历史评论。

评论为旧站历史记录,本站不再接受新评论。