Error message may occur if you try to install or upgrade Exchange Server
http://go.microsoft.com/fwlink/?LinkID=320888
Target | Microsoft.KnowledgeServices.Exchange.2010.Server | ||
Parent Monitor | System.Health.ConfigurationState | ||
Category | Alert | ||
Enabled | True | ||
Alert Generate | True | ||
Alert Severity | Warning | ||
Alert Priority | Normal | ||
Alert Auto Resolve | True | ||
Monitor Type | Microsoft.KnowledgeServices.Library.PowerShellMonitorEx | ||
Remotable | True | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Default | ||
Comment | SupportTopic=TBD;VersionNumber=1.0.0.0; |
<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>
$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
</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>