Book Image

Microsoft Exchange Server PowerShell Cookbook

Book Image

Microsoft Exchange Server PowerShell Cookbook

Overview of this book

Table of Contents (21 chapters)
Microsoft Exchange Server PowerShell Cookbook Third Edition
Credits
About the Authors
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 this. Now you might like 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 this 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 by checking the WhenMailboxCreated property. If the date is within the last seven days, we select a few useful properties for each...