Check OAB Generator

In Exchange 2007 Mailbox Servers there is a "Hidden" Role Called the OAB Generator.


You can view it form the Exchange Managment Console and decide wich Mailbox CCR Server will have that role.


A Known problem is when you move node in the CCR and then there is no Offline Address Book available for download.


View it on Technet : Offline Address Book Generation Fails on a Server That Is Running Exchange 2007 Cluster Continuous Replication


For This I created this script, that checks if the server you are running on is the active node of the CCR cluster and if it holds the OAB Generator Role.

If it is the Active Node but it doesn't hold the role than you are asked if you want to change it.


Download The Script

 


# Author : Assaf Miron

# Http://assaf.miron.googlepages.com

# Description :

# This Script Checks if the Current Node of an Exchange Server 

# Holds the Offline Address Book Generator (OABGen).

# If it Doesnt, it allows you to change it.

# Input : Exchange Server Name

# Output: Change the EnableOabGenOnThisNode Registry Value on the Active Node


param ( $ServerName = (Read-Host "Enter Server Name") )

# Get the Current Computer Name

$ComputerName = Hostname


#region Check Cluster Owner

$Clu = New-Object -com "MSCluster.Cluster"

$Clu.Open($ServerName)

$GroupOwner = $Clu.ResourceGroups.Item($ServerName).OwnerNode.Name

#endregion


#region Checking if the current Node has the EnableOabGenOnThisNode set to it

# Set the EnableOabGenOnThisNode Registry Key

$OABPath = "HKLM:\SYSTEM\CurrentControlSet\Services\MSExchangeSA\Parameters\"+$ServerName 

# Checking if the Current Node is the Active Node (Group Owner)

if ($GroupOwner -eq $computerName)

{

# Get the EnableOabGenOnThisNode Registry Value

$OABGen = Get-ItemProperty -Path $OABPath

Write-Host "OAB is Currently set on "$oabGen.EnableOabGenOnThisNode 

if($oabGen.EnableOabGenOnThisNode -ne $computerName)

{

# The Current Node is not Set in the EnableOabGenOnThisNode Reg Value

if((Read-Host "Do you Want to change it to the Current Node?`nChange? [Y/N]") -contains "Y") {

Write-Host "Changing the OAB Parameter to the Current Node"

# Set the EnableOabGenOnThisNode Value Data to the Name of the Current Node

Set-ItemProperty -Path $OABPath -Name 'EnableOabGenOnThisNode' -Value $computerName

Write-Host "OAB Parameter Is Set to the Current Node"

}

}

}

else # Not the Active Node

{

Write-Warning "This is not the Active Node"

}

#endregion 

Comments