--勉励自己努力以钉子的“挤”劲和“钻”劲提升自己
 :: Blog List ::
钉子 发表于 2013-9-25 15:41:00

一.  查询邮箱数

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

发表评论:

    昵称:
    密码: (游客无须输入密码)
    主页:
    标题:
Best view with 1024 x 768 pixel & IE 6.0.
About Me
Archives Categories
Replies List
My FriendLinks
Blog Info

Powered by Oblog.