Thanks for the great article. One thing I found was the difficulty to update a large number of accounts which were already created with the msExchQueryBaseDN value. I have compiled which I hope will be helpful for others in the smae situation.
$strFilter = "user"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = "LDAP://ou=Fabrikam,OU=Companies,DC=contoso,DC=com"
$objSearcher.SearchScope = "Subtree"
$objSearcher.PageSize = 1000
$objSearcher.Filter = "(objectCategory=$strFilter)"
$colResults = $objSearcher.FindAll()
foreach ($i in $colResults)
{
$objUser = $i.GetDirectoryEntry()
$UserDN = $objUser.distinguishedName
$UserN = $objUser.Name
Write-Host "Processing User: " $UserN
$user = ([ADSI]"LDAP://DC1:389/$UserDN").psbase
$user.Properties["msExchQueryBaseDN"].Value = "ou=Fabrikam,OU=Companies,DC=contoso,DC=com"
$user.CommitChanges();
Write-Host ""
}