Exchange Server 2007

Exchange : Database Sizing Scripts

Exchange : Database Sizing Scripts

I’ve recently been asked to size some Exchange 2007 environments for migration to Exchange 2010; specifically database sizes. I used the following scripts to perform this task.

Export User Mailbox Sizes

This script will give you an idea of allocated storage, regardless of Single Instance Storage – this is important as Exchange 2010 no longer includes Single Instance Storage. Microsoft suggest that you should allow a 15% increase in storage, in reality I’ve found this to be a very accurate figure to go by. Change the server name in the script an you’re good to go.

{code lang:css showtitle:false lines:false hidden:false}Get-MailboxServer <server name> | Get-MailboxStatistics | Sort -Property TotalItemsize | select-object DisplayName, LastLoggedOnUserAccount, ItemCount, @{name=”Size(MB)”;expression={$_.totalitemsize.value.ToMB()}} | export-csv stats.csv{/code}

Find Database File Size

This script will show the physical file size of each database. Remember this will not give an indication of the true data size of all user mailboxes, unless you add approx 15% to the size (YMMV). Again, change the server name.

{code lang:css showtitle:false lines:false hidden:false}Get-ExchangeServer <server name> | Get-MailboxDatabase | foreach-object {add-member -inputobject $_ -membertype noteproperty -name mailboxdbsizeinMB -value ([math]::Round(([int64](get-wmiobject cim_datafile -computername $_.server -filter (‘name=”’ + $_.edbfilepath.pathname.replace(“\”,”\\”) + ””)).filesize / 1MB),2)) -passthru} | Sort-Object mailboxdbsizeinMB -Descending | format-table identity,mailboxdbsizeinMB{/code}

Database Whitespace

If you are using Enterprise Vault or something similar chances are you’ll have a good chunk of white space in your database which you wont need to provision for on the new environment. To identify the amount of white space in your database files use the code below, execute on the Mailbox server itself.

{code lang:css showtitle:false lines:false hidden:false}$yesterday = [DateTime]::Now.AddDays(-1)
$Events = Get-Eventlog Application | Where {($yesterday -le $_.TimeWritten)} | ?{$_.eventid -eq “1221”}
$Events | select-object Message | ft{/code}

Exchange Server 2007

Troubleshoot OOF

Troubleshoot OOF:

Exchange Server 2007

Exchange 2007 : SendAs Distribution List

Exchange 2007 : SendAs Distribution List

Use the following Exchange Shell command to enable users to Send As a Distribution list or Mail-Enabled Security Group:

get-group “Group Name” | Add-AdPermission -user “UserName” -AccessRights extendedright -ExtendedRights “send as”

Exchange Server 2007

Exchange 2007 : Recipient Flter Multiple Countries

Exchange 2007 : Recipient Flter Multiple Countries

Here is an example recipient filter used in an Email Address policy that will apply an address based upon multiple factors, including one of two different countries:

Set-EmailAddressPolicy “NL Users” –RecipientFilter {((Co -eq “Netherlands, The” -or Co -eq “Netherlands”) -and (RecipientType -eq ‘UserMailbox’))} –EnabledEmailAddressTemplates ‘SMTP:%g.%[email protected]’, ‘smtp:%[email protected]

Exchange Server 2007

Exchange 2007 : Delegate User DL Management via Exchange Shell

Exchange 2007 : Delegate User DL Management via Exchange Shell

The following command will grant a user the rights to modify the members of a Distribution List:

Add-ADPermission -Identity:’DL Display Name’ -User:sAMAccountName -AccessRights ReadProperty, WriteProperty -Properties ‘Member’

Exchange Server 2007

Exchange 2007 : User Mailflow Tracking

Exchange 2007 : User Mailflow Tracking

The following Exchange Shell commands will produce send/receive reports for user mail and export to CSV in the local directory – be sure to change CAHTSRV01/02 to the correct server name:

get-messagetrackinglog -resultsize unlimited -server CAHTSRV02 -sender [email protected] -eventid send | select-object @{Name="Recipients";Expression={$_.recipients}},MessageSubject,Timestamp | export-csv userSurname-SentCAHTSRV02.csv

get-messagetrackinglog -resultsize unlimited -server CAHTSRV01 -sender [email protected] -eventid send | select-object @{Name="Recipients";Expression={$_.recipients}},MessageSubject,Timestamp | export-csv userSurname-SentCAHTSRV01.csv

get-messagetrackinglog -resultsize unlimited -server CAHTSRV01 -recipients [email protected] -eventid receive | select-object sender,MessageSubject,Timestamp | export-csv userSurname-ReceivedCAHTSRV01.csv

get-messagetrackinglog -resultsize unlimited -server CAHTSRV02 -recipients [email protected] -eventid receive | select-object sender,MessageSubject,Timestamp | export-csv userSurname-ReceivedCAHTSRV02.csv
Exchange Server 2007

PFDavAdmin : WIndows 7

PFDavAdmin : WIndows 7

In order to get PFDavAdmin working on Windows 7 you must install .NET Framework 1.1, otherwise you will get errors when trying to connect, expand or modify DACLs. You can get a Windows 7 64-bit compatible version from here:

PFDavAdmin has been replaced;

Exchange Server 2007

Exchange 2007 : Convert Linked Mailbox to User Mailbox

Exchange 2007 and 2010 : Convert Linked Mailbox to User Mailbox

During a migration cleanup I came across several user mailboxes that were ‘Linked’ and not ‘User’ mailboxes.

(In a non resource forest model) this is usually caused by;

  1. Associated External Account Permission
  2. Attribute ‘msExchMasterAccountSid’ is not null  / ‘msExchRecipientTypeDetails’ set to ‘2’ (both are usually as a result of 1)

Associated External Account Permission

Executing the following command did reveal that there was a permission for an External Account (despite the account being in the same domain as the mailbox):

{code lang:xml title:”Show Mailbox ExternalAccount Permission” lines:true hidden:false}$mbx = Get-Mailbox “alias”
$mbx | Get-MailboxPermission | ? {$_.accessrights -like “*ExternalAccount*”} {/code}

Attribute ‘msExchMasterAccountSid’ is not null  / ‘msExchRecipientTypeDetails’ set to ‘2’

Using adsiedit I confirmed that the ‘msExchRecipientTypeDetails’ attribute was set to 2 (Linked) and not 1 (User), and that the ‘msExchMasterAccountSid’ attribute was not null (not default!).

Correcting the Issue

Executing the following script in the Exchange Management Shell will change ALL mailboxes from Linked to user, modify the mailbox alias as required. Be sure this is what you want to do! In a Resource Forest scenario this would be undesirable to say the least!

{code lang:css title:”Cleanup Script” lines:true hidden:false}# Identify all LINKED mailboxes
$linkedmbx = Get-Mailbox | ? {$_.islinked -eq $true}

foreach ($mbx in $linkedmbx)

# Find and Remove Associated External Account Permission
$extacc = $mbx | Get-MailboxPermission | ? {$_.accessrights -like “*ExternalAccount*”}
Remove-MailboxPermission -Identity $mbx.DistinguishedName -User $extacc.User -AccessRights ExternalAccount

# Change the Mailbox Type and Null the msExchMasterAccountSid attribute for the user
$LDAPPath = “LDAP://” + $mbx.DistinguishedName
$LDAPPath | fl

$user = [ADSI]”$LDAPPath”
$user | fl


Exchange Server 2007

Exchange 2007 : You cannot open free/busy information

Exchange 2007 : You cannot open free/busy information

I had a user who was unable to add calendar entries to a Room Mailbox calendar. The error she received was:

You cannot open free/busy information. You do not have sufficient permissions to perform this opertation on this object.

This was caused by the user not having full mailbox permissions on the resource mailbox. Use the following command to configure mailbox permissions to allow the user to create new entries in the calendar:

Add-MailboxPermission -Identity “Room Mailbox 1” -User ‘domain\user’ -AccessRights ‘FullAccess’

You can also use the following command to apply this change to a number of similar named mailboxes, this command assumes that all the room names start with ‘Room’:

get-mailbox “Room*” | Add-MailboxPermission -User ‘domain\user‘ -AccessRights ‘FullAccess’

Exchange Server 2007

Exchange 2007 : Room / Resource Mailbox Conflicts and Cancelations Not Processed.

Exchange 2007 : Room / Resource Mailbox Conflicts and Cancellations Not Processed.

I recently came across an issue with the room mailbox configuration on our Exchange 2007 environment. Cancellations were remaining in the calendar and duplicate appointments were being booked at the same time, resulting in the room becoming double-booked.

The issue was that the mailbox ‘AutomateProcessing’ setting was ‘AutoUpdate’ instead of AutoAccept. To resolve this simply execute the following command from the Exchange shell:

Set-MailboxCalendarSettings “MeetingRoomName” -AutomateProcessing:Autoaccept

To extend the booking window use the following command:

Set-MailboxCalendarSettings “MeetingRoomName” -BookingWindowInDays 540

To allow reocurring meetings and cancel conflicts:

Set-MailboxCalendarSettings “MeetingRoomName” -AllowConflicts False
Set-MailboxCalendarSettings “MeetingRoomName” -ConflictPercentageAllowed 25
Set-MailboxCalendarSettings “MeetingRoomName” -MaximumConflictInstances 10

To grant a user full mailbox permissions:

Add-MailboxPermission “MeetingRoomName” -AccessRights FullAccess -Identity “[email protected]

To restrict booking the resource to a particular user/set of users:

Set-MailboxCalendarSettings “MeetingRoomName” -BookInPolicy “[email protected]”,”[email protected]

To allow other users to book the resource, but have their request authorised:

Set-MailboxCalendarSettings “MeetingRoomName” -AllBookInPolicy:$False -AllRequestOutOfPolicy $False -AllRequestInPolicy $True

To configure the delegates that must authorise the request (they will receive a copy of the request):

Set-MailboxCalendarSettings “MeetingRoomName” -ResourceDelegates “[email protected]“,”[email protected]