Thursday, June 17, 2010

Exchange 2007 Management Shell Commands

I'll try to add to these over time as I remember and as I learn more.  These are some of the Exchange 2007 Management Shell commands that I use and why.  The blue words are the commands and the red words need to be replaced with your information.

When you see a Get-Mailbox, you can leave it alone and the command will get all mailboxes or you can add in switches such as -server, -database, or -identity to select smaller groups.

1. Do a user who needs full access to all mailboxes, maybe for legal or audit reasons.  Replace "useraccount" with the account of the person who needs full access.  The second line removes the full access from all mailboxes for the specified user.
Get-Mailbox | Add-MailboxPermissions -AccessRights FullAccess -User useraccount
Get-Mailbox | Remove-MailboxPermissions -AccessRights FullAccess -User useraccount

2. Need to set set the MaxSendSize and MaxReceiveSize for all mailboxes at once.  You can write the number out such as 20480 will be the same as 20MB.  Or you can use KB, MB, GB, or TB at the end to shorten it.

Get-Mailbox | Set-Mailbox -MaxSendSize 20MB
Get-Mailbox | Set-Mailbox -MaxReceiveSize 20MB

3. Run an Exchange CCR Cluster, type Get-Sto and hit tab twice to get to Get-StorageGroupCopyStatus and press enter to get a list of all of your storage groups and their copy status, copy and replay queue lengths, and last inspected log time.  This is faster then opening the EMC and going to Server Configuration/Mailbox and give you a little more information.

4. Need mailbox statistics.
This will give you details stats on a single mailbox.
Get-MailboxStastics user |fl
This will give you the mailbox name, item count, storage limit status (if you have one), and last logon time for every mailbox in the specified database.
Get-MailboxStastics -database yourdatabase

No comments:

Post a Comment