Exchange GAL error Analysis – Eventid 9325

Hi Readers,

If you want to troubleshoot:- Why some users are not available in Offilne address book & also have issues with

Default Global address List in exchange then this post might interests you.

First of all go to exchange management console & enable the diagnostics logging of Offline address book generator server

to medium.

When the offilne address book is generated you will see below kind of events in the eventvwr.

For analyzing it automatically I have written the power-shell solution(link to download is below) which will email you the entries that are having issues.

http://gallery.technet.microsoft.com/scriptcenter/Exchange-Address-Book-9f828d87

Please edit the script code & add relevant email addresses & smtp server (defined at end of .ps1 script)

edit batch file :- (enter the server name on which OAB is generated)

powershell .\eventAnalysis.ps1 Application server1 9325

 

Code:- 

######################################################################## 
#       Author: Vikas Sukhija 
#       Date: 10/10/2013 
#       Description: Analyze OAB errors 
######################################################################## 
#######################Define Parameters################################ 

Param ( 

$eventtype, 
$computerName, 
$eventid 

) 

#########################Add Exchange Shell############################# 

If ((Get-PSSnapin | where {$_.Name -match "Exchange.Management"}) -eq $null) 
{ 
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin 
} 

#########################Add log files################################# 

$date = get-date -format d 
$date = $date.tostring() 
$date = $date.replace("/","-") 

$log1 = ".\logs\" + "EventAnalysis" + $date + "_.log" 
$log2 = ".\logs\" + "OABissues" + $date + "_.log" 

#######################get event id & split the message ################# 
$date = get-date  
$date = $date.ToShortDateString() 

$collevent = Get-EventLog -LogName $eventtype -ComputerName $computerName ` 
 -after $date | Where {$_.Eventid -eq $eventid} 

$time = get-date -format t 
$collevent.count 
$eventcount = $collevent.count 
Add-content $log1 "$time - Number of Events - $eventcount" 

foreach($event in $collevent)  { 

$evn = $event.Message 

$evn1 = $evn -replace "OALGen will skip user entry " 

$evn2 = $evn1 -replace "in address","=" 

$evn3 = $evn2.split("=") 

$evn4= $evn3[0].trim() 

$str = $evn4.substring(1,$evn4.length-2) 

write-host $str 
$time = get-date -format t 

add-content $log1 "$time - User mentioned in eventid - $str" 

$mailbox = get-mailbox  $str 

if($mailbox -ne $null) 

{ 
$time = get-date -format t 
$alias = $mailbox.alias 

Write-host "$time - $alias mailbox has issues with OAB" 
add-content $log1 "$time - $alias mailbox has issues with OAB" 
add-content $log2 "$alias mailbox has issues with OAB" 

} 
} 
#####################Send email to Messaging Team###################### 

$email = "Vikas.Sukhija@labtest.com" 
$from = "donotreply@labtest.com" 
$subject = "Oab Errors to be fixed" 
$body = get-content $log2 | out-string 
$smtpserver ="smtpserver" 

$message = new-object Net.Mail.MailMessage 
$smtp = new-object Net.Mail.SmtpClient($smtpserver) 

$message.From = $from 
$message.To.Add($email) 
$message.body = $body 
$message.subject = $subject 

$smtp.Send($message) 

########################################################################

Regards

Sukhija Vikas

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s