Tracking transaction log generation per hour

I’ve been working on the Exchange 2007 Mailbox Storage Calculator for my Exchange 2007 migration project.  The spreadsheet asks for the number of logs generated per hour so it can appropriately calculate the bandwidth needed for CCR and SCR log shipping.

Below is the script I wrote to do this for me.  Simply edit it to fit your Exchange server.  Since I have mulitple servers, I wrote one for each server, editing the name of the log file to match.  Then i created a batch file that runs each script for each Exchange server and created a scheduled task to re-run once per hour every hour.

FIlename: Count-Logs-EXCHSRVRNAME.ps1

function writetolog([string]$stringtowrite=”*”)
     $datetime = (Get-Date).datetime
     Add-Content $logfile “$datetime : $stringtowrite”

#the path to the log file you want to generate containing the count of
#transaction logs
$logfilename = “C:exchserver1-logcount.log”

#Make sure the count log file exists before attempting to write to it
if (Test-Path $logfilename) {Write-Host “Log file exists.”;$logfile = $logfilename} Else {Write-Host “Creating log file $logfilename”;$logfile = New-Item $logfilename -Type file}

#Path to the transaction logs for each storage group
$sg0path = “path to logs for SG0”
$sg1path = “path to logs for SG1”
$sg2path = “path to logs for SG2”
$sg3path = “path to logs for SG3”
$sg4path = “path to logs for SG4”

#Count the log files in each path, add them together and write that to the
#count log.
$sg0count = (get-childitem $sg0path).count
$sg1count = (get-childitem $sg1path).count
$sg2count = (get-childitem $sg2path).count
$sg3count = (get-childitem $sg3path).count
$sg4count = (get-childitem $sg4path).count
$date = get-date
writetolog ($sg0count + $sg1count + $sg2count + $sg3count + sg4count)

The count log file will contain data for each hour in the following format:

Tuesday, August 11, 2009 10:00:15 AM : 121
Tuesday, August 11, 2009 11:00:17 AM : 137

Simply import these logs into Excel, massage the data as needed to get an accurate count of how many log files are generated each day.  You’ll need to calculate the difference between each line of data to know how many logs were generated since the last count was taken since the script just counts the total number of logs in the directory.  You may need to add up the number for all the log files you generate if you’re generating one for each server you have.

Don’t forget to multiply by 5 before inputing the number into the Storage Calculator spreadsheet, though!  Exchange 2007 logs are 1MB in size while Exchange 2003 logs were 5MB in size!

Redirect email destined for purged mailboxes

You’ve seen it before.  A user leaves your company, you delete or purge their mailbox, and they decide they want to come back to their old job.  So, you create a new AD account and mailbox for them.

Problem is: some of their old coworkers still have old messages from them before they left, and when they reply to those messages they think it’s gonna go to their new mailbox.  Only they’re confused when they get the following NDR:

Your message did not reach some or all of the intended recipients.


      Subject:    RE: Old conversation

      Sent: 9/30/2008 8:22 PM


The following recipient(s) cannot be reached:


      Blow, Joe on 9/30/2008 8:22 PM

            The e-mail account does not exist at the organization this message was sent to.  Check the e-mail address, or contact the recipient directly to find out the correct address.

            < #5.1.1>


This is because the old message contains the legacyExchangeDN as the return address.  You created a new mailbox so there’s a new legacyExchangeDN for that same person.  How do you fix this so that users can reply to old messages and have those replies get delivered to the new mailbox?

Add a new E-mail address to the AD object for the returning user in the format of:

        Set the E-mail type to be X500

See for more info

Troubleshooting Removing Public Folder Replicas

The last few weeks have been challenging for me because of Public Folders.  In my environment I have a site in Tempe, AZ that has two exchange servers (let’s call them server1 and server2).  Server1 is an old box and we want to decomission it.  It was only hosting a few small resource mailboxes and replicas of public folders relevant to that site.

Removing the resource mailboxes was easy – I just used the Move Mailbox function in ESM.  Public folders hasn’t been so easy – though it should have been.

To move all the replicas hosted on Server1, i opened ESM, navigated down to the public folder store node, right-clicked and chose Move All Replicas, then selected Server2 from the list.

Now, Server2 already had replicas of most of these same public folders so all i was really interested in was making sure the hierarchy was updated to show that Server1 was no longer hosting replicas.  I could test this by looking in the Public Folder Instances node on Server1 and looking for it to reveal empty white space.  It worked great except for a few hundred folders that just wouldn’t seem to disappear.

I began to troubleshoot this issue by viewing the public folder replicaion events that are generated when you turn up logging.  To see these events, enable the following options on the Diagnostic Logging tab of each exchange server involved in replicaion:

  • MSExchangeIS
    •  Public Folder
      • Replication AD Updates – Maximum 
      • Replication Incoming Messages – Maximum
      • Replication Outgoing Messages – Maximum
      • Non-delivery Reports – Maximum
      • Replication Backfill – Maximum
      • Replication General – Maximum

There’s a really great article on The Microsoft Exchange Team Blog by Bill Long that goes into great detail about how to troubleshoot Public Folder Replication with these events.

I noticed on my servers that I was still getting 3030 events with a Type of 0x4 which reflects incoming content from Server2.  How could this be when the folder in question no longer shows Server1 as hosting a replica of that folder?

Event Type: Information
Event Source: MSExchangeIS Public Store
Event Category: Replication Incoming Messages
Event ID: 3030
Date:  8/15/2008
Time:  2:13:20 PM
User:  N/A
Computer: SERVER1
An incoming replication message was processed.

 Type: 0x4
 Message ID: <>
 Folder: (1b-79DC) IPM_SUBTREECompanyLead ManagementPoint Of Sale

 Database “PUBPublic Folder”.
 CN min: 6c-626B02B
 CN max: 6c-626B02B
 MIDs: 1
1: 6c-5C382BE

 MIDSET deleted: {0}

 Server: /O=Company/OU=TEMPE/cn=Configuration/cn=Servers/cn=Server2/cn=Microsoft Public MDB

Get Mailbox Quota information from Exchange 2003

I wrote the script below to get all the mailbox quota information from all my users.  It loads the Quest ActiveRoles snappin if it doesn’t already exist, and created a .log file with all the data.  It is a |-separated file.

Write-Host “Checking ActiveRoles Snapin”
if (Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction silentlycontinue) {Write-Host “Added ActiveRoles Snapin”} Else {Write-Host “Snapin present.”}
Remove-Item “mbxquotas.log”
$logfile = New-Item “mbxquotas.log” -Type file
Add-Content $logfile “UserName|mDBStorageQuota|mDBOverQuotaLimit|mDBOverHardQuotaLimit|homeMDB”
$users = Get-QADUser -Sizelimit 0
$users | foreach
  {$user = get-qaduser $_
   $datastring = $ + “|” + $user.mdbstoragequota + “|” + $user.mdboverquotalimit + “|” + $user.mdboverhardquotalimit + “|” + $user.homemdb
   Add-Content $logfile -Value $datastring