Exchange 2010: View Mailbox and Folder size

Largest Mailbox Folders in Size

Show top ten largest Mailbox folders on the Mailbox Server sorted by size. (Observe that this is a resource intensive cmdlet if you have a lot of Mailboxes on the selected Server)

Get-Mailbox –Server ‘lab3-sv-exm-01’ -ResultSize Unlimited | Get-MailboxFolderStatistics -FolderScope All | Sort-Object FolderSize -Descending | Select-Object -First 10 | FT Identity,FolderSize,ItemsInFolder –wrap


Show top ten largest Mailbox folders on the Mailbox Server sorted by size for the Archive Mailboxes. (Observe that this is a resource intensive cmdlet if you have a lot of Mailboxes on the selected Server)

Get-Mailbox –Server ‘lab3-sv-exm-01’ -ResultSize Unlimited | Get-MailboxFolderStatistics -Archive -FolderScope All | Sort-Object FolderSize -Descending | Select-Object -First 10 | FT Identity,FolderSize,ItemsInFolder –wrap

Show top ten largest Mailbox folders on a specified Database sorted by size. (Observe that this is a resource intensive cmdlet if you have a lot of Mailboxes in the specified Database)

Get-Mailbox –Database ‘Database1’ -ResultSize Unlimited | Get-MailboxFolderStatistics -FolderScope All | Sort-Object FolderSize -Descending | Select-Object -First 10 | FT Identity,FolderSize,ItemsInFolder –wrap

Show top ten largest Mailbox folders on a specified Database sorted by size for the Archive Mailboxes. (Observe that this is a resource intensive cmdlet if you have a lot of Mailboxes in the specified Database)

Get-Mailbox –Database ‘Archive-Database1’ -ResultSize Unlimited | Get-MailboxFolderStatistics -Archive -FolderScope All | Sort-Object FolderSize -Descending | Select-Object -First 10 | FT Identity,FolderSize,ItemsInFolder –wrap

Show top ten largest Mailbox folders for a single User sorted by size.

Get-Mailbox -Identity ‘User1’ -ResultSize Unlimited | Get-MailboxFolderStatistics -FolderScope All | Sort-Object FolderSize -Descending | Select-Object -First 10 | FT Identity,FolderSize,ItemsInFolder –wrap

Show top ten largest Mailbox folders for a single User sorted by size for the Archive Mailbox.

Get-Mailbox -Identity ‘User1’ -ResultSize Unlimited | Get-MailboxFolderStatistics -Archive -FolderScope All | Sort-Object FolderSize -Descending | Select-Object -First 10 | FT Identity,FolderSize,ItemsInFolder –wrap

Most Items in an single Mailbox Folder

Show top ten Mailbox folders with most Items on the Mailbox Server sorted by items count. (Observe that this is a resource intensive cmdlet if you have a lot of Mailboxes on the selected Server)

Get-Mailbox –Server ‘lab3-sv-exm-01’ -ResultSize Unlimited | Get-MailboxFolderStatistics | Sort-Object ItemsInFolder –Descending | Select-Object -First 10 | FT Identity,ItemsInFolder,FolderSize –Wrap

Show top ten Mailbox folders with most Items on the Mailbox Server sorted by items count for the enabled Archive Mailboxes. (Observe that this is a resource intensive cmdlet if you have a lot of Mailboxes on the selected Server)

Get-Mailbox –Server ‘lab3-sv-exm-01’ -ResultSize Unlimited | Get-MailboxFolderStatistics -Archive | Sort-Object ItemsInFolder –Descending | Select-Object -First 10 | FT Identity,ItemsInFolder,FolderSize -Wrap

Show top ten Mailbox folders with most Items on a specified Database sorted by items count. (Observe that this is a resource intensive cmdlet if you have a lot of Mailboxes in the specified Database)

Get-Mailbox –Database ‘Database1’ -ResultSize Unlimited | Get-MailboxFolderStatistics | Sort-Object ItemsInFolder –Descending | Select-Object -First 10 | FT Identity,ItemsInFolder,FolderSize –wrap

Show top ten Mailbox folders with most Items on a specified Database sorted by items count for the enabled Archive Mailboxes. (Observe that this is a resource intensive cmdlet if you have a lot of Mailboxes in the specified Database)

Get-Mailbox –Database ‘Archive-Database1’ -ResultSize Unlimited | Get-MailboxFolderStatistics | Sort-Object ItemsInFolder –Descending | Select-Object -First 10 | FT Identity,ItemsInFolder,FolderSize –wrap

Show top ten Mailbox folders with most Items for a single User sorted by items count.

Get-Mailbox -Identity ‘User1’ -ResultSize Unlimited | Get-MailboxFolderStatistics | Sort-Object ItemsInFolder –Descending | Select-Object -First 10 | FT Identity,ItemsInFolder,FolderSize –wrap

Show top ten Mailbox folders with most Items for a single User sorted by items count for the enabled Archive Mailbox.

Get-Mailbox -Identity ‘User1’ -ResultSize Unlimited | Get-MailboxFolderStatistics -Archive | Sort-Object ItemsInFolder –Descending | Select-Object -First 10 | FT Identity,ItemsInFolder,FolderSize –wrap

Largest Specified Mailbox Folder in Size

Continue reading

Posted in Exchange 2010 | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , | 11 Comments

Exchange 2010: Exclude Mailbox Database from Automatic Mailbox Provisioning

Exchange 2010 introduces a new feature that automatically load balance creation of new mailboxes across all available databases when a creation of a new mailbox account occurs. It’s no longer mandatory to specify what database mailbox should reside on as Exchange uses a mailbox provisioning agent to take the decision for you on what mailbox database the mailbox creation will be created on.

How is mailbox provisioning agent deciding?

Mailbox provisioning agent scans for all databases within the same Active Directory site when new mailbox request is created. The provisioning agent selects the database randomly for the new mailbox from the all available databases that are mounted and have database attribute “IsExcludedFromProvisioning” and “IsSuspendedFromProvisioning” set to $False . It´s important to know that mailbox provisioning agent does not take the current number of mailboxes in a database into account when it selects a target database, so let´s hope we see a more intelligent provision in the future.

To verify what mailbox databases are activated for automatic mailbox provisioning run the following EMS command:

Get-MailboxDatabase | ft Name,IsExcludedFromProvisioning,IsSuspendedFromProvisioning

In my case all mailbox databases are enabled for automatic mailbox provisioning and by default all new mailbox databases created using EMC are added to automatic mailbox provisioning.

So if you want to make life easier for admins that use EMC or EMS to create new mailbox accounts without needing actively selecting database and also have to wonder witch database they should select from a load balance scenario then disable the automatic mailbox provisioning on the mailbox databases you don’t want provisioning agent to automatically create mailboxes on and have it only enabled for databases you choose.

To disable mailbox database from the automatic mailbox provisioning you have two to archive this:

Set-MailboxDatabase –Identity ‘Database-01′ –IsExcludedFromProvisioning $True

or

Set-MailboxDatabase –Identity ‘Database-01′ –IsSuspendedFromProvisioning $True

To enable mailbox database with the automatic mailbox provisioning just set the option to $False

Set-MailboxDatabase –Identity ‘Database-01′ –IsExcludedFromProvisioning $False

or

Set-MailboxDatabase –Identity ‘Database-01′ –IsSuspendedFromProvisioning $ False

You only need to run one of those commands, “IsExcludedFromProvisioning” or “IsSuspendedFromProvisioning”. According to Microsoft the difference is:

The “IsExcludedFromProvisioning” parameter specifies that this database is permanently not considered by the mailbox provisioning load balancer. If the IsExcludedFromProvisioning parameter is enabled, new mailboxes aren’t added automatically to this database. You can manually add a mailbox if your role permits.

The “IsSuspendedFromProvisioning” parameter specifies that this database is temporarily not considered by the mailbox provisioning load balancer.

When you now run the New-Mailbox wizard you don’t need to specify the mailbox database manually but let the mailbox provisioning handle this.

Posted in Exchange 2010 | Tagged , , , , | 1 Comment

Exchange 2010: View available white/free space in your database

I’ll start sharing some PowerShell commands I use in Exchange for my daily administrator task.

AvailableNewMailboxSpace also called database white space is database pages that were previously used to store items and mailboxes that have been deleted and are available for reuse by Exchange to store new mailboxes, items and attachments. This space will be reused as soon as new content will be written to the database and before the database file size grows.

So if you have migrated a lot of mailboxes for balancing purpose or any other reason and wonder why you database is not smaller in file size that’s because database don’t reclaim the file size space back but transfer that to the white space whitch is then used for new content. The only way to shrink the database file size after a large mailbox migration is to run the “ESEUTIL” witch is not recommended especially in DAG scenarios were the rebuild transforms the internal structure of the database, so any of the transactions in the logs cannot be applied if the need occurs to recover transactions through log replay . In cases where a lot data has been removed from a database and a lot of white space remains, rather than performing an offline defragmentation with “ESEUTIL” on the database, you can move the mailboxes online to a new database and delete the original database.

Anyway to view how much database white space you have on your databases run the following cmdlet:

Get-MailboxDatabase -Status | Sort-Object DatabaseSize -Descending | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace

Posted in Exchange 2010 | Tagged , , , , | Leave a comment

Exchange 2010 RBAC: Limit management for VIP users

Does your organization require selective permission model who manage permission for CEO or VIP users in an Exchange 2010 organization?

Step 1. Create a new Universal Security Group for all members you want to protect and add all users you want to protect to the new group.

New-DistributionGroup -Name “SEC-GRP-VIP_Restricted_Users” -OrganizationalUnit “adatum.com/Groups” -SamAccountName “SEC-GRP-VIP_Restricted_Users” -Alias “sec-grp-vip_restricted_users” -Notes “Contains members of all restricted VIP users” -Type “Security”

Step 2. Create a new Universal Security Group for administrators that’s allowed to manage all protected users and add the administrators to this new created group.

New-DistributionGroup -Name “SEC-GRP-VIP_Admins” -OrganizationalUnit “adatum.com/Groups” -SamAccountName “SEC-GRP-VIP_Admins” -Alias “sec-grp-vip_admins” -Notes “Contains members that allows to manage restricted VIP users” -Type “Security”

Step 3. Create a “New-ManagementScope” that includes the group of your restricted users. ManagmentScopes are used to define who or what the permission should apply to, this could be OU, Security Groups, Servers or Databases.

New-ManagementScope -Name “VIP_Protected_Managers_ManagementScope” -RecipientRestrictionFilter { MemberOfGroup -eq “cn=SEC-GRP-VIP_Restricted_Users,ou=Groups,dc=adatum,dc=com” } -Exclusive

Step 4. Assign an management role for the new VIP administrators, in this example i´m adding Mail Recipients management role, but you can add any “ManagementRole”. You use role assignment to assign permissions

New-ManagementRoleAssignment -Name “VIP_Protected_Managers_ManagementRoleAssignment” -Role “Mail Recipients” –SecurityGroup “SEC-GRP-VIP_Admins” –ExclusiveRecipientWriteScope “VIP_Protected_Managers_ManagementScope”

This was created on Exchange 2010 SP1.

Built-in Management Roles

Posted in Exchange 2010 | Tagged , , , , , , | 2 Comments