Categories
Exchange Server 2010

Exchange 2010 : Mailbox Size Report

Exchange 2010 : Mailbox Size Report

The following script will report on all mailbox sizes, from largest to smallest and generate  CSV file in the directory from which it is executed.

{code lang:php title:”Mailbox Size Report” lines:false hidden:false}$data = @()
foreach($mbx in Get-MailboxDatabase | Get-Mailbox)
{
$dispname = $mbx.displayName
$data += Get-MailboxStatistics $mbx.identity | select @{n=”Username”;e={$mbx.displayName}},@{e={$_.TotalItemSize.Value.ToMB()};n=”TotalItemsSize(MB)”}
}
$data | sort-object “TotalItemsSize(MB)” –Descending | export-csv MailboxSizes.csv{/code}

 

Categories
Exchange Server 2010

Exchange 2010 : Deleted Items Retention Size Report

Exchange 2010 : Deleted Items Retention Size Report

The following script will generate a CSV file that reports on per-user Deleted Items Retention (Dumpster 2.0) sizes.

{code lang:php title:”Mailbox Deleted Items Retention Report” lines:false hidden:false}$data = @()
foreach($mbx in get-mailboxdatabase | get-mailbox)
{
$data += Get-MailboxStatistics $mbx.identity | Select @{n=”DisplayName”;e={$_.DisplayName}},@{e={$_.TotalDeletedItemSize.Value.ToMB()};n=”TotalDeletedItemsSize(MB)”},DeletedItemCount
}
$data | export-csv retention.csv{/code}

Categories
Exchange Server 2010

Exchange 2010 : Deleted Items Folder Size Report

Exchange 2010 : Deleted Items Folder Size Report

The following script can be used to report on user mailbox “Deleted Items” folder sizes (and sub folders). It will create a CSV file in the directory from which the script is executed.

{code lang:php title:”Mailbox Deleted Items Folder Size Report” lines:false hidden:false}$data = @()
foreach($mbx in Get-MailboxDatabase | Get-Mailbox)
{
$dispname = $mbx.displayName
$data += Get-MailboxFolderStatistics $mbx.identity -FolderScope ‘DeletedItems’ | select @{n=”Username”;e={$mbx.displayName}},FolderPath,ItemsInFolder,@{n=”FolderSize(MB)”;e={$_.folderSize.toMB()}}
}
$data | sort-object “FolderSize(MB)” –Descending | export-csv DeletedItemsFolders.csv{/code}

 

Categories
Exchange Server 2010

Exchange 2010 : Create a Message Send Size Limit For A Subset Of Users Within an Exchange Organisation

Exchange 2010 : Create a Message Send Size Limit For A Subset Of Users Within an Exchange Organisation

We recently encountered a requirement to limit a subset of users to a maximum send size without imposing this organisation wide – this was achieved this using a transport rule, the steps are outlined below.

  1. Create a Distribution Group that contains all your Exchange Users that you wish to limit email size for. For this example this group has an email address of [email protected].
  2. Create a new Dsn Error message: New-SystemMessage -DsnCode 5.7.50 -Language En -Internal $True -Text ‘Your message has not been sent as it exceeds the maximum allowed message size of 20MB. Please contact the helpdesk for support on 123 or click here to raise a support ticket <a href=”http://helpdesk/riaseticket.html”>Open Support Ticket</a>.’
  3. Next create a new transport rule (change the [email protected] email address to reflect the group created in step 1) : New-TransportRule “Block Internal Email over 50MB” -FromMemberOf “[email protected]” -attachmentSizeOver 50MB -RejectMessageEnhancedStatusCode “5.7.50” -RejectMessageReasonText “Your message has not been sent as it exceeds the maximum allowed message size.” -SentToScope “InOrganisation”
  4. Verify the priority of any other transport rules configured in your Exchange Organisation.
You can now test this by attempting to send an email over 20MB, it will be rejected as long as you are a member of this distribution group.
Categories
Exchange Server 2010

Exchange 2010 : Troubleshooting Inter-Exchange Organistaion Mailflow

Exchange 2010 : Troubleshooting Inter-Exchange Organistaion Mailflow

We recently got caught out by the introduction of an Exchange Server to a relatively new AD site. Prior to the deployment of the server the AD DS site was not an Exchange Site.

After a few hours we started to get calls regarding mail stuck in a queue with the nexthop set as the AD DS site where the new Exchange Server had been deployed. We confirmed this using the Exchange Shell command: get-queue

So we knew that the new Exchange AD DS Site was the root cuase, but why? Next port of call was the Exchange Routing Log Viewer, available from the Exchange Management Console, under Toolbox.

First things first you’ll need to edit the file. From the File menu select ‘Open log file…’ Enter a HT server name then click ‘Browse server files.” Right-click the filw you wish to open and select ‘Open with…’ then select ‘Notepad.’ Now remove all of the lines that read ‘<SourceOrTargetServers />‘ – if you do not complete this step you wont be able to view the log files.

Now open the file in the Routing Log Viewer, expand Active Directory Sites and then a site where delivery of mail to has been affected. You should be able to verify the a) next hop and b) cost of delivery.

You can also compare logs using ‘File’ > ‘Compare log file…’ (remember to edit the file as before). This outlined the changes in routing caused by the site – changes we were unaware would be triggered by deployment of Exchange.

The next step was to acertain where the AD DS site link cost was coming from, there was a IP site link that we were unaware existed. It turned out to be the DefaultIPSiteLink contained this site and another key site – thus skewing the Exchange Routing Table once Exchange had been deployed to this site. This left us three options:

  1. Remove the new Exchange Site from the DefaultIPSiteLink
  2. Assign an Exchange Site Link cost to this site link (using set-adsitelink)
  3. Increase the cost of the DefaultIPSiteLink in AD DS

We went with option 1, the problem then cleared up within a few minutes; moral of the story – when deploying Exchange into an Active Directory site where it has not previously been installed check any and all site links where the AD DS site is defined as a member.

Categories
Exchange Server 2010

Exchange 2010: Troubleshooting Public Folder Referrals

Exchange 2010: Troubleshooting Public Folder Referrals

I had an issue today where a user from another Mailbox server/domain (same forest/Exchange Org) was unable to access public folders on a different Exchange server.

It turned out that the users home Public Folder Database had been configured to allow refferals to only a single server. To identify this I used the following Exchange Shell Command:

{code lang:css title:”Exchange Shell Command” lines:false hidden:false}

$pfdb = Get-PublicFolderDatabase -IncludePreExchange2010

$pfdb | select-object servername,name,UseCustomReferralServerList,CustomReferralServerList | ft

{/code}

 

To resolve the issue the Exchage Admin needed to add the destination Public Folder Database Servers to the CustomReferralServerList.

Categories
Exchange Server 2010

Exchange 2010 : OABGen Issues – PublicFolderDatabase

Exchange 2010 : OABGen Issues – PublicFolderDatabase

I came across an issue recently with an Exchange 2010 migration (same Organisation/Forest) where the OAB was not updating. On further investigation I identified that the following events were being logged on the mailbox database servers which were the home mailbox database servers for the affected users:

Log Name:      Application

Source:        MSExchangeSA

Description:

OABGen encountered error 80040111 while cleaning the offline address list public folders under /o=ORGNAME/cn=addrlists/cn=oabs/cn=OABNAME.  Please make sure the public folder database is mounted and replicas exist of the offline address list folders.  No offline address lists have been generated.  Please check the event log for more information.

– \OABNAME   

Using the command Get-OfflineAddressBook | select-object name,PublicFolderDatabase it was possible to identify that the PublicFolderDatabase that the OAB was set to publish to was incorrect.

Unforunately there is not an Esxchange Shell command to change this, you must use ADSIedit. Using ADSIedit browse to the following location, changing the items in bold to match your environment:

“CN=OABName,CN=Offline Address Lists,CN=Address Lists Container,CN=ORGNAME,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=DOMAIN,DC=LOCAL

Right-click this object and select properties. We’re interested in the siteFolderServer attribute – you’ll probably find this is incorrectly set if you’re getting the error above.

Next use the Exchange Shell to get the DN of a Public Folder Database in the same site; get-publicfolderdatabase | select-object DistinguishedName | fl

Copy the DN of the Public Folder Database into the siteServerName attribute of the failed OAB.

Update: 29/09/2011 – You should also confirm the replication scope of the OAB Public Folder mentioned in the error.  

You then have to restart the Exchange information Store service on the affected servers – of course this will interrupt mailbox database connectivity so if you have a DAG then I would suggest you perform failovers to minimise impact – if not then this may be an out of hours change!

Once completed run the Exchange Shell command from above to confirm that the PublicFolderDatabase setting is correct; Get-OfflineAddressBook | select-object name,PublicFolderDatabase

You can also perform an update of the OAB (update-offlineaddressbookname“) and then download it in a cached mode client to confirm functionality.

Categories
Exchange Server 2010

Exchange 2010 : View Transport Server Queue

Exchange 2010 : View Transport Server Queue

Use the following Exchange Shell command to view the current queue o all transport servers:

get-transportserver | get-queue

This can be limited to a subset of servers using the query below. This method of changing the scope of the command relies on you servers having a similar name, in this case all servers start “UK” :

get-transportserver “UK*” | get-queue

Categories
Exchange Server 2010

Exchange 2010 : View Mailbox Database Size

Exchange 2010 : View Mailbox Database Size

Use the following Exchnage Shell command to view the size of ALL Mailbox Databases within your Exchange Organisation.

Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize

You can limit this to particular Databases using the command below, this will return sizing information on Mailbox Databases which have a name starting with “UK” – this could be modified to FR for example if all of your Mailbox Databases in France started with “FR” :

Get-MailboxDatabase “UK*”  -Status | select ServerName,Name,DatabaseSize

Categories
Exchange Server 2010

Exchange 2010 : Export-Csv EmailAddressPolicies by Priority

Exchange 2010 : Export-Csv EmailAddressPolicies by Priority

Use the following Exchange Shell command to export EmailAddressPolicy information, yes this is a large command in order to join all of the multi-string values together:

{code lang:xml showtitle:false lines:false hidden:true}Get-EmailAddressPoicy | select-object name,priority,RecipientFilter,RecipientFilterType,IncludedRecipients,EnabledPrimarySMTPAddressTemplate,Enabled,@{name=’ConditionalDepartment’;Expression={[STRING]::JOIN(";",($_.ConditionalDepartment))}},@{name=’ConditionalCompany’;Expression={[STRING]::JOIN(";",($_.ConditionalCompany))}},@{name=’ConditionalStateOrProvince’;Expression={[STRING]::JOIN(";",($_.ConditionalStateOrProvince))}},@{name=’ConditionalCustomAttribute1′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute1))}},@{name=’ConditionalCustomAttribute2′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute2))}},@{name=’ConditionalCustomAttribute3′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute3))}},@{name=’ConditionalCustomAttribute4′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute4))}},@{name=’ConditionalCustomAttribute5′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute5))}},@{name=’ConditionalCustomAttribute6′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute6))}},@{name=’ConditionalCustomAttribute7′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute7))}},@{name=’Conditio,alCustomAttribute8′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute8))}},@{name=’ConditionalCustomAttribute9′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute9))}},@{name=’ConditionalCustomAttribute10′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute10))}},@{name=’ConditionalCustomAttribute11′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute11))}},@{name=’ConditionalCustomAttribute12′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute12))}},@{name=’ConditionalCustomAttribute13′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute13))}},@{name=’ConditionalCustomAttribute14′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute14))}},@{name=’ConditionalCustomAttribute15′;Expression={[STRING]::JOIN(";",($_.ConditionalCustomAttribute15))}},@{name=’RecipientContainer’;Expression={[STRING]::JOIN(";",($_.RecipientContainer))}},@{name=’ObjectClass’;Expression={[STRING]::JOIN(";",($_.ObjectClass))}},@{name=’NonAuthoritativeDomains’;Expression={[STRING]::JOIN(";",($_.NonAuthoritativeDomains))} } | sort-object priority | export-csv C:\export.csv{/code}</p>'</p>’