Exchange 2010 Helpful CMDLETS

Here are some useful cmdlets that I’ve collected over time and keep on hand in my toolbox.  I hope they come in handy for you as well:

The following command will retrieve the entire Outlook folder hierarchy of a user’s Primary mailbox and export it to a csv file.  It’s useful in situations where a user has a lot of folders and is unable to locate emails or certain folders.  To get the Archive mailbox folder structure, add the “archive” switch.

Get-Mailbox “username” | Get-MailboxFolderStatistics | select folderpath | export-csv “desired path”

This command will list Exchange ActiveSync users assigned to a specific ActiveSync policy:

Get-content C:\content2.txt | Get-CASMailbox |select primarysmtpaddress, ActiveSyncMailboxPolicy | export-Csv C:\policy.csv -notype

If you need to find out the available new space or white space on all mailbox databases, use the following:

Get-MailboxDatabase -Status | Select-Object Server,Name,AvailableNewMailboxSpace | Export-csv “desired path”

This is how you enable a Retention Hold on a group of users for a specified period of time.  The command will retrieve the input from a list of users and pipe it to the command.  No items will be Archived for the users during this time frame:

Get-content C:\userlist.txt | Set-Mailbox -RetentionHoldEnabled $true -StartDateForRetentionHold ’10/06/2015 10:47:24 PM’ -EndDateForRetentionHold ’11/06/2015 8:58:24 PM’

Here’s how to move a group of users Primary mailbox to a another database.  Change the PrimaryOnly switch to ArchiveOnly to move the Archive mailboxes.  A list of users will get piped to the command to initiate the move to the target database:

Get-Content C:\userlist.txt | New-MoveRequest -Confirm:$False -PrimaryOnly -SuspendWhenReadyToComplete -TargetDatabase “Database”

This is just a sample of some of the commands that I use on a regular basis.  I hope you find this information to be helpful.

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s