Exchange Quick Audit: mailboxes created in last 7 days
Posted by Bharat Suneja at 6:46 AM
Let's take a look at how the shell (EMS) makes it so easy.
In this examnple, we need to get a list of all accounts created in the last 7 days. When a user account is created, its whenCreated attribute gets stamped with the time of creation. Here's how it can be used:
Get-User -resultsize unlimited | where {$_.WhenCreated -gt (get-date).adddays(-7) | ft Name,whenCreated -Autosize
Similarly, when an AD object is changed, it's whenChanged attribute gets stamped with the time the change was made. This makes it easy to determine which objects were changed in a given period, a useful tool for auditing/reporting as well as troubleshooting. In the following example, we determine if any Receive Connectors were changed in the last 7 days.Get-ReceiveConnector | where {$_.whenChanged -gt (get-date).adddays(-7)}
Another frequently required and requested report— how do I get a list of mailboxes that haven't been accessed in the last X days. Let's use 100 days as the value here:Get-MailboxStatistics -resultsize unlimited | where {$_.LastLogonTime -lt (get-date).AddDays(-100)} | ft displayName,lastlogontime,lastloggedonuseraccount,servername
Or mailboxes that have never been logged on to:Get-MailboxStatistics -resultsize unlimited | where {$_.LastLogonTime -eq $null | ft displayName,lastlogontime,lastloggedonuseraccount,servername
Note, you can filter mailboxes by Database or ServerName to restrict the results to a more manageable size.Next, let's list mailboxes disabled in the last 14 days:
Get-MailboxStatistics | Where {$_.DisconnectDate -gt (get-date).AddDays(-14)} | ft displayName,ServerName,DatabaseName,TotalItemSize -Autosize
Labels: Administration, Compliance, Exchange Server 2007, Exchange Shell

Exchangepedia Blog is read by visitors from all 50 US States and 150 countries world-wide

An existing Recipient Policy can be modified to add/remove Mailbox Manager or Email Address settings by right-clicking the policy and selecting Change property pages.
From the Property Pages dialog box, select the appropriate settings to be included in the Recipient Policy.

