Categories
Exchange Server 2010

Exchange 2010 ; Mailbox Statistics with sAMAccountName

I needed to get mailbox statistics, alongside user sAMAccountName in order to plan an Exchnage 2010 migration; the script below is a modified version of one I found here. Save as a “.ps1” file and run from the Exchange Management Shell, the script will create a csv file under C:\Temp.

{code lang:php showtitle:false lines:false hidden:false}$r=@()
get-mailboxdatabase * | get-mailbox -resultsize unlimited | foreach {$l = “”| Select sAMAccountName,displayName,Size,serverName,databaseName,ItemCount; $l.sAMAccountName = $_.samaccountname; $l.Size =
 (get-mailboxstatistics -id $_.distinguishedname).totalitemsize; $l.displayName = $_.DisplayName; $l.ItemCount = (get-mailboxstatistics -id $_.distinguishedname).ItemCount; $l.databaseName = $_.database; $l.serverName = $_.serverName; $r += $l};
$r | export-csv c:\Temp\Sizing.csv -notype -encoding ascii {/code}

 

Categories
Exchange Server 2010

Exchange 2010 : Export SMTP Email Addresses to CSV

Use the following PowerShell script to export a list of email addresses into a CSV file. The file will containt displayName, primarySMTPAddress and emailAddresses (proxyAddresses).

{code lang:ini showtitle:false lines:false hidden:false}$tbldata = @()
$arrmbx = get-mailbox -resultsize unlimited

foreach ($mbx in $arrmbx ) {
    $mailstring = ”    
    $record = @{}
    [array]$SmtpProxyAddresses = $mbx.emailaddresses | Where {$_.prefixstring -like ‘smtp’} | sort IsPrimaryAddress -Descending
    
    foreach ($mailadd in $SmtpProxyAddresses) {
            $mailadd = $mailadd -replace “smtp:”
            If ($mailstring -eq ” ) {
                $mailstring = $mailadd
            }
            ELSE {
                $mailstring += “,” +$mailadd
            }
    }
    
    $record.displayName = $mbx.name
    $record.primarySMTP = $mbx.primarySMTPaddress
    $record.emailAddress = $mailstring
    $tbldata += new-object PSObject -Property $record    
}

$tbldata | Export-Csv “Email Addresses.csv” -NoTypeInformation
{/code}

Categories
Exchange Server 2010

Exchange 2010 : How to Deploy a Mailbox Database Availability Group (DAG)

In this article I’ll cover deployment of a two-node, multi-role Exchange 2010 Database Availability Group (DAG). The required steps from schema updates to post-installation configuration will be detailed in order to get you up and running… hopefully!

Categories
Exchange Server 2010

Outlook : Waiting to update this Folder…

Outlook : Waiting to update this Folder…

I encountered an issues recently with an outlook 2007 client that, when in cached mode only, would not automatically update maibox folder such as Inbox. In the bottom right of the window the user simply had “Waiting to update this folder…” The user was alo receiving “Out of Memory” error when trying to browse public folders.

On further investigation we noted that the users RPC requst count (shown in the Outlook Connection Status window – Ctrl-click the Outlook Icon) was very high and quickly increasing to the Public Folder server.

It became aparent that the user had many Public Folder Favourites defined, hundreds of folders with thousands of emails. In online mode we deleted the Public Folder Favourites, then deleted the users OST. Finally we set the user back to Cached Mode. This resolved their Outlook issues, and dramaically improved Outlook performance.

Categories
Exchange Server 2010

Exchange 2010 : DAG – Move Primary Active Manager

Exchange 2010 : DAG – Move Primary Active Manager

To view the current Primary Active Manager use the following command:
{code lang:css showtitle:false lines:false hidden:false}get-databaseavailabilitygroup <name> -status | select name,primaryactivemanager{/code}

From one of the DAG members run the command: cluster group
This will show the “Cluster Group” owner is the Primary Active Manager.

To move the PAM, use the command below from one of the DAG members – note when tested this did not affect Exchange resources – your mileage may vary;
{code lang:css showtitle:false lines:false hidden:false}cluster group “Cluster Group” /MoveTo:<DAG Server Name>{/code}

Categories
Exchange Server 2010

Exchange 2010 : Moving Passive Database Copies to a different DAG Server

Exchange 2010 : Moving Passive Database Copies to a different DAG Server

I recently encountered a requirement to move several passive database copies, each of approx 200GB in size to differnet servers. Ideally I wanted to acheieve this withought having to re-seed the databases. I wanted to try and leverage database portability in some respects, keeping the existing data and simply presenting the disks containing that data to the new DAG server. Here’s how this was acheived:

Prepare your target server;

  • The server should be a member of the same DAG as the source
  • The server should be able to connect to the same disks (although do not do this yet)

Moving the Database Copies

Step 1: Suspend the Mailbox Database Copy
Step 2: Remove the Mailbox Database Copy (the database and log files will be left on the drives)
Step 3: Disconnect the LUN’s from the original server (DO NOT FORMAT/DELETE the disks)
Step 4: Present the same disks to the new server, again do not format or repartition.
Step 5: Add the mailbox database copy;

{code lang:css showtitle:false lines:false hidden:false}add-mailboxdatabasecopy -id “database name” -mailboxserver “DAG server name” -seedingpostponed:$true{/code}

Step 6: Resume the mailbox database copy:

{code lang:css showtitle:false lines:false hidden:false}resume-mailboxdatabasecopy “database name”\”DAG server name”{/code}

Step 7: Confirm the copy status:

{code lang:css showtitle:false lines:false hidden:false}Get-MailboxDatabaseCopyStatus “database name”{/code}

If the new copy is stuck in ‘Resynchronizing’ then suspend the copy and resume it.

Equally speaking you could restore a backup or use a VSS snapshot of the databases as outlined in the following article:
http://blogs.technet.com/b/timmcmic/archive/2011/07/12/exchange-2010-using-vss-to-perform-an-online-offline-database-seed.aspx

Once you have moved the passive database copy, you can activate it and perform the same steps to move the now passive copy on the other server(s).

Categories
Exchange Server 2010

Exchange 2010 : Useful Logs

Exchange 2010 : Useful Logs

The following logs on Exchnage 2010 CAS/HT and Mailbox Servers (logs vary between role division) are available to aid troubleshooting:

C:\Program Files\Microsoft\Exchange Server\V14\Logging\AddressBook Service\AddressBook*
C:\Program Files\Microsoft\Exchange Server\V14\Logging\Imap4\IMAP4*
C:\Program Files\Microsoft\Exchange Server\V14\Logging\Pop3\POP3*
C:\Program Files\Microsoft\Exchange Server\V14\Logging\RPC Client Access\RCA*
C:\inetpub\logs\LogFiles\W3SVC1\u_ex*

Categories
Exchange Server 2010

Exchange 2010 : Transport Server Pressure Script

Exchange 2010 : Transport Server Pressure Script

The below script will output the ResourceManager status of all transport servers, this can be useful when troubleshooting functions performed by Exchange 2010 transport servers.

{code lang:php lines:false hidden:false title:false}foreach ($srv in get-transportserver -identity "*") {
  [xml]$diag = Get-ExchangeDiagnosticInfo –Server $srv.identity –Process EdgeTransport –Component ResourceManager –Argument verbose
  $srv.name
  $diag.Diagnostics.Components.ResourceManager.CurrentComponentStates
  $diag.Diagnostics.Components.ResourceManager.ResourceMonitors.ResourceMonitor | ft –a Type, Resourc*,*Pressure* | out-string
  Get-counter -ComputerName $srv.name -Counter "\MSExchange RpcClientAccess\RPC Averaged Latency" –SampleInterval 5 -MaxSamples 2
}{/code}

To understand what pressure states mean, and the impact of each state take a look at the following TechNet article: http://technet.microsoft.com/en-us/library/bb201658.aspx

Categories
Exchange Server 2010

Exchange 2010 : High Item Count in Critical Path Folder

Exchange 2010 : High Item Count in Critical Path Folder

There is a significant performance impact of high item count in critical path folder on any version of Exchange. The script below can be used to help identify users in your environment with 20,000 or more items in any folder you specify. Change the folder in red to modify the scope of the script.

{code lang:php showtitle:false lines:false hidden:false}$data = @()
foreach($mbx in get-mailboxdatabase | get-mailbox) {
$data += get-mailboxfolderstatistics -Identity $mbx.identity -FolderScope ‘Inbox’| Where {($_.ItemsInFolder -ge 20000)} | select @{n=”Username”;e={$mbx.displayName}},FolderPath,ItemsInFolder }
# $data | ft
$data | Sort ItemsInfolder -Descending | export-csv InboxOver20k.csv {/code}

Categories
Exchange Server 2010

Exchange 2010 : Find Users with iOS 4.0 Devices (User Agent 801.29)

Exchange 2010 : Find Users with iOS 4.0 Devices (User Agent 801.29)

The following Exchange Shell Script will identify all users that have an iOS 4.0 device – these should be upgraded to 4.01+ ASAP. Save the code below into a .ps1 file and execute.