Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Overview of this book

Table of Contents (22 chapters)
Microsoft Exchange 2010 PowerShell Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Reporting on mailbox creation time


If you work in an environment that frequently hires new employees, you may have a process in place to provision your mailboxes in bulk. You may have already used this book to help you do that. Now you might like to be able to generate reports or retrieve a list of mailboxes that were created during a specific time frame or after a specific date. In this recipe, you will learn a couple of ways to do that using the Exchange Management Shell.

How to do it...

Let's start off with a simple example. To generate a report of mailboxes created in the last week, execute the following command:

Get-Mailbox -ResultSize Unlimited | 
  ?{$_.WhenMailboxCreated –ge (Get-Date).AddDays(-7)} | 
    Select DisplayName, WhenMailboxCreated, Database | 
      Export-CSV C:\mb_report.CSV -NoType

How it works...

This one-liner searches through every mailbox in the organization checking the WhenMailboxCreated property. If the date is within the last seven days, we select a few useful...