AKN590973

Monitor_AKN590973 (UnitMonitor)

Error message may occur if you try to install or upgrade Exchange Server

Knowledge Base article:

External

http://go.microsoft.com/fwlink/?LinkID=320888

Element properties:

TargetMicrosoft.KnowledgeServices.Exchange.2010.Server
Parent MonitorSystem.Health.ConfigurationState
CategoryAlert
EnabledTrue
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.KnowledgeServices.Library.PowerShellMonitorEx
RemotableTrue
AccessibilityPublic
Alert Message
Error message may occur if you try to install or upgrade Exchange Server
<Details>
<Content>You may receive an error message regarding write access when you try to install or upgrade Microsoft Exchange Server. For example, when you try to upgrade Microsoft Exchange Server 2010 Service Pack 1 (SP1) to Exchange Server 2010 SP2. This issue occurs if the CustomSD registry value is incorrect. See the KB article for more information and how to resolve this issue.</Content>
<CollectedInformation>
<Info>
<Name>ApplicationKeyContainsCorrectCustomSD</Name>
<Value>{0}</Value>
</Info>
<Info>
<Name>SystemKeyContainsCorrectCustomSD</Name>
<Value>{1}</Value>
</Info>
</CollectedInformation>
</Details>
RunAsDefault
CommentSupportTopic=TBD;VersionNumber=1.0.0.0;

Source Code:

<UnitMonitor ID="Monitor_AKN590973" Comment="SupportTopic=TBD;VersionNumber=1.0.0.0;" Accessibility="Public" Enabled="true" Target="MicrosoftKnowledgeServicesExchange2010Library!Microsoft.KnowledgeServices.Exchange.2010.Server" ParentMonitorID="Health!System.Health.ConfigurationState" Remotable="true" Priority="Normal" TypeID="KnowledgeServicesLibrary!Microsoft.KnowledgeServices.Library.PowerShellMonitorEx" ConfirmDelivery="true">
<Category>Alert</Category>
<AlertSettings AlertMessage="MonitorMessage66463d08999443399d017e4e51d458a8">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Warning</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Data/Context/Property[@Name='ApplicationKeyContainsCorrectCustomSDOutput']$</AlertParameter1>
<AlertParameter2>$Data/Context/Property[@Name='SystemKeyContainsCorrectCustomSDOutput']$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<ScriptName>AKN590973.ps1</ScriptName>
<Parameters/>
<ScriptBody><Script>

$ErrorActionPreference = "Stop"

# Set up the arguments
$scriptargs = new-object psobject

# Set up the output
$global:scriptoutput = new-object psobject
$scriptoutput | add-member NoteProperty "HasIssue" $false
$scriptoutput | add-member NoteProperty "ApplicationKeyContainsCorrectCustomSDOutput" $false
$scriptoutput | add-member NoteProperty "SystemKeyContainsCorrectCustomSDOutput" $false
#-----------------------------------------------------
# MAIN CODE SECTION
#-----------------------------------------------------

# Environment

$scriptenv = New-Object System.Management.Automation.PSObject
$scriptenv | Add-Member NoteProperty "RuntimeError" $false
$scriptenv | Add-Member ScriptProperty "IsExistCustomSDInApplicationEnv" {return (Get-Item "HKLM:\System\CurrentControlSet\Services\Eventlog\Application" -ErrorAction SilentlyContinue).Property -contains "CustomSD"}
$scriptenv | Add-Member ScriptProperty "IsExistCustomSDValueDataInApplicationEnv" {return (Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\Eventlog\Application" -ErrorAction SilentlyContinue).CustomSD -match "\(A;;0x7;;;BA\)"}
$scriptenv | Add-Member ScriptProperty "IsExistCustomSDInSystemEnv" {return (Get-Item "HKLM:\System\CurrentControlSet\Services\Eventlog\System" -ErrorAction SilentlyContinue).Property -contains "CustomSD"}
$scriptenv | Add-Member ScriptProperty "IsExistCustomSDValueDataInSystemEnv" {return (Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\Eventlog\System" -ErrorAction SilentlyContinue).CustomSD -match "\(A;;0x7;;;BA\)"}


# Main function

Function AdvisorRule($scriptargs, $scriptoutput)
{
# All parameters should be populated outside of the main function.
# The mian function should only include the detection logic so that it can be easyly reused by the Atlanta authoring tool.
trap [Exception] {
$scriptenv.RuntimeError = $true
continue
}

# Initialize parameters
$scriptoutput.HasIssue = $false
$scriptoutput.ApplicationKeyContainsCorrectCustomSDOutput = $false
$scriptoutput.SystemKeyContainsCorrectCustomSDOutput = $false


# Detection Logic

$applicationCondition = $scriptenv.IsExistCustomSDInApplicationEnv -eq $true -and $scriptenv.IsExistCustomSDValueDataInApplicationEnv -eq $false
$systemCondition = $scriptenv.IsExistCustomSDInSystemEnv -eq $true -and $scriptenv.IsExistCustomSDValueDataInSystemEnv -eq $false

$scriptoutput.ApplicationKeyContainsCorrectCustomSDOutput = -not $applicationCondition
$scriptoutput.SystemKeyContainsCorrectCustomSDOutput = -not $systemCondition

if($applicationCondition -or $systemCondition)
{
if($scriptenv.RuntimeError -eq $false)
{
#Raise alert
$scriptoutput.HasIssue = $true
}
}
}
AdvisorRule $scriptargs $scriptoutput

# set the output
$mom = new-object -comobject "MOM.ScriptAPI"
$bag = $mom.CreatePropertyBag()

if ($scriptoutput.HasIssue -ne $null)
{
$bag.AddValue("HasIssue", $scriptoutput.HasIssue)
}

if ($scriptoutput.ApplicationKeyContainsCorrectCustomSDOutput -ne $null)
{
$bag.AddValue("ApplicationKeyContainsCorrectCustomSDOutput", $scriptoutput.ApplicationKeyContainsCorrectCustomSDOutput)
}

if ($scriptoutput.SystemKeyContainsCorrectCustomSDOutput -ne $null)
{
$bag.AddValue("SystemKeyContainsCorrectCustomSDOutput", $scriptoutput.SystemKeyContainsCorrectCustomSDOutput)
}

$bag

</Script></ScriptBody>
<SnapIns/>
<TimeoutSeconds>300</TimeoutSeconds>
<Schedule>86379</Schedule>
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Boolean">Property[@Name='HasIssue']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="Boolean">true</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
<SuccessExpression>
<Not>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Boolean">Property[@Name='HasIssue']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="Boolean">true</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</Not>
</SuccessExpression>
</Configuration>
</UnitMonitor>