Exchange 2010: Mailbox Size

This post demonstrates how you can use Exchange Powershell to list and export user mailbox size, including deleted items size.

Run the command below to generate a list of all users, what databse their mailbox is stored in, the TotalItemSize, and TotalDeletedItemSize (Storage space used in the recoverable items folder)

Get-MailBox | Get-MailboxStatistics | select DisplayName,DatabaseName,TotalItemSize,TotalDeletedItemSize,StorageLimitStatus

To export these statistics to a CSV file, append | Export-CSV $strFileName to the end of the command.

Get-MailBox | Get-MailboxStatistics | select DisplayName,DatabaseName,TotalItemSize,TotalDeletedItemSize,StorageLimitStatus | Export-CSV $strFileName

To sort the results in order of size, you can use the Sort-Object parameter

Get-MailBox | Get-MailboxStatistics | select DisplayName,DatabaseName,TotalItemSize,TotalDeletedItemSize,StorageLimitStatus | Sort-Object TotalItemSize -Descending

See Also:

Logon as a Service

Allow Account to Log on as a service Right

You can use this procedure to add the Log on as a service right to an account on your computer.

  1. To open Local Security Policy, click Start, point to Control Panel, point to Administrative Tools, and then double-click Local Security Policy.
  2. In the console tree, double-click Local Policies, and then click User Rights Assignment.
  3. In the details pane, double-click Log on as a service.
  4. Click Add User or Group, and then add the appropriate account to the list of accounts that possess the Log on as a service right.

More Info


How To: Find and Remove Inactive Computer Accounts from Active Directory

There are a number of reasons why you may need to find and remove inactive computers from active directory. Test computers and servers that were removed without disconnecting from the domain, or in my case, a computer fleet upgrade. New computers were brought in to replace the old computers, leaving a large number of un used computer objects in Active Directory that should be cleared out.

There are a couple of ways to identify whether a computer account in Active Directory is stale. The approach I found useful is running dsquery from the domain controller.

dsquery computer -inactive 8 -limit 0

The -inactive 8 paremeter lets dsquery know to find computers that have been inactive for 8 weeks.
By default, dsquery will return only 100 results. Use the -limit parameter to list more than 100 results if needed.

Note: Keep in mind that you may have some Laptop computers in the field that do not often connect to Active Directory.

The command dsquery computer -inactive 8 will run for the entire domain of the computer in question. Additional parameters, such as querying only specified OUs, can be performed to target certain areas such as old server accounts.

To export the results to a CSV file, use the following:

dsquery computer -inactive 8 -limit 0 >> c:\export.csv

Exchange 2010: Storage Quota Warnings are not Sending

In exchange 2010 SP1, users are not receiveing quota warning messages when they are beyond the Issue Warning threshold.

Microsoft have an article relating to this issue.
Users do not receive quota warning messages after you apply Service Pack 1 for Exchange Server 2010

To resolve this issue, follow these steps:

  1. Install the following update rollup package:
        2608646 Description of Update Rollup 6 for Exchange Server 2010 Service Pack 1

  2. After you install the update rollup package that is described in step 1, modify the registry. To do this, follow these steps:
        a.Click Start, click Run, type regedit, and then click OK.
        b. Locate and then click the following registry subkey:

        c. On the Edit menu, point to New, and then click DWORD Value.

        d. Type CheckWarningQuota, and then press Enter.

        e. Right-click CheckWarningQuota, and then click Modify.

        f. In the Value data box, type 1, and then click OK.

        g. Exit Registry Editor.

3.Restart the Microsoft Exchange Information Store service.


Exchange 2010: Set Work Hours for Room Mailbox

In Exchange 2010, when you create a room or resource mailbox, the Resource Policy tab gives you the option to Allow scheduling only during business hours. But what is business hours?

The default business hours is from 8:00 am until 5:00 pm. You can check this by running this PowerShell command

Get-MailboxCalendarConfiguration -Identity <mailboxidentity> | fl

Tp change the woprking hours for an individual resource, run the following command

Set-MailboxCalendarConfiguration -Identity <mailboxidentity> -WorkingHoursStartTime 
<start time in format 00:00:00> -WorkingHoursEndTime <end time in format 00:00:00>


Set-MailboxCalendarConfiguration -Identity room1-WorkingHoursStartTime 08:30:00 
-WorkingHoursEndTime 17:30:00

And if you want to change the settings for all room mailboxes:

Get-Mailbox | Where {$_.RecipientTypeDetails -eq "RoomMailbox"} | 
Set-MailboxCalendarConfiguration -WorkingHoursStartTime 08:30:00 -WorkingHoursEndTime 17:30:00

See also Manage resource work hours in Exchange Server 2007 and 2010

How To: MS SQL Empty Database Log File

You will often find your database log file (.ldf) growing to a very large size, often larger than the databasie file (.mdf) itself.

Log files should shrink after a full backup, but this isnt always the case. Below is a quick command you can run to empty a database log file.

backup log [dbname] with truncate_only

Note: Clearing the transaction log with TRUNCATE_ONLY will break your backup chain needed for FULL recovery. A FULL database backup should be executes right after truncating the logs.

See Also:
Truncate or Srink a large Log File
How to empty a SQL Server database transaction log file