Monday, April 23, 2012

Exchange 2010 Test-MAPIConnectivity Failure

The cause to why the command Test-MAPIConnectivity result in a failure relating to Public Folders is likely due to an empty Servers container from an old Exchange 2003 environment. The remedy is simply to delete the empty Servers container in the old Exchange 2003 administrative group. This issue usually originates from an alert from Operations Manager but it could be nice to know the real source of the problem. My understanding is that a bug in the command is the real culprit here but your guess is as good as mine.

Thursday, April 19, 2012

Bulk import thumbnail photos

In these days of increasing messaging and collaboration using such excellent services as Exchange, Lync and Sharepoint, the need to import thumbnail photos into the Active Directory is in high demand. There are many options to perform this task  but I prefer the one tool that will eventually rule them all, PowerShell. Gather all user pictures and place them in a folder with the following prerequisites.

  • The files must have names that corresponds to unique user attributes such as SamAccountName
  • The files must not exceed 10kb in size
  • The dimensions of the pictures should be the recommended 96x96 pixels but this isn't required
  • All files must be JPEG images (*.jpg)

Once the folder with above mentioned prerequisites have been established, the following script imports them to the Active Directory.

Path = 'C:\Temp\ImportThumbnails\Photos'
import-module ActiveDirectory
ForEach ($File in Get-ChildItem $Path | Where-Object { $_.Extension -eq ".jpg" } )
{
  $UserName = $File.Name.substring(0, $File.Name.Length - 4)
  Write-Host $UserName -NoNewLine
  $Photo = [byte[]](Get-Content -Path $File.Fullname -Encoding byte)
  Set-ADUser $UserName -Replace @{thumbnailPhoto=$Photo}
  Write-Host " [Done]" -ForeGroundColor Green
}

Don't forget to make sure that the thumbnailPhoto attribute is replicated to the Global Catalog in the Active Directory Schema.

Tuesday, April 10, 2012

Active Directory Schema update

Too many times have I seen how people update the Active Directory schema without taking precautions. A problem during the update could lead to a catastrophic event with no way out other than a forest wide restore. Devoting a couple of minutes to take the safe road is always worth it. These are the simple steps required to perform a safe schema update.

  • Make sure the current state of the Active Directory is healthy. Verify that all replication is working as expected.
  • Introduce a new virtual domain controller and make sure everything is replicated.
  • Transfer the FSMO Schema Master to the new domain controller and isolate it from the rest but running the following commands.
Repadmin /options <DC> +DISABLE_INBOUND_REPL
Repadmin /options <DC> +DISABLE_OUTBOUND_REPL
  • Update the schema and make sure there are no problems.
  • Enable replication by running the following commands.
Repadmin /options <DC> -DISABLE_INBOUND_REPL
Repadmin /options <DC> -DISABLE_OUTBOUND_REPL
  • Wait for replication, transfer the FSMO Schema Master to the original domain controller and remove the newly introduced domain controller from the Active Directory (dcpromo).

Easy as pie and totally worth it.