AKN601028

Monitor_AKN601028 (UnitMonitor)

The servicing stack update 2871777 reduces errors when appling Windows Server 2012 updates.

Knowledge Base article:

External

http://go.microsoft.com/fwlink/?LinkId=324142

Element properties:

TargetMicrosoft.KnowledgeServices.Windows.OperatingSystem
Parent MonitorSystem.Health.ConfigurationState
CategoryAlert
EnabledTrue
Alert GenerateTrue
Alert SeverityError
Alert PriorityHigh
Alert Auto ResolveTrue
Monitor TypeMicrosoft.KnowledgeServices.Library.PowerShellMonitorEx
RemotableTrue
AccessibilityPublic
Alert Message
Servicing stack update 2871777 reduces errors when applying Windows Server 2012 updates.
<Details>
<Content>The servicing stack update 2871777 helps resolve issues when you apply Windows Server 2012 updates or install the Remote Desktop Connection Broker role on the Windows Server 2012. See the following articles for more details.</Content>
<CollectedInformation />
</Details>
RunAsDefault
CommentSupportTopic=TBD;VersionNumber=1.0.0.0;

Source Code:

<UnitMonitor ID="Monitor_AKN601028" Comment="SupportTopic=TBD;VersionNumber=1.0.0.0;" Accessibility="Public" Enabled="true" Target="MicrosoftKnowledgeServicesWindowsLibrary!Microsoft.KnowledgeServices.Windows.OperatingSystem" ParentMonitorID="Health!System.Health.ConfigurationState" Remotable="true" Priority="High" TypeID="KnowledgeServicesLibrary!Microsoft.KnowledgeServices.Library.PowerShellMonitorEx" ConfirmDelivery="true">
<Category>Alert</Category>
<AlertSettings AlertMessage="MonitorMessage0191691230b543d7b25aa5880d13f7ee">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>High</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<ScriptName>AKN601028.ps1</ScriptName>
<Parameters>
<Parameter>
<Name>StrOSVersion</Name>
<Value>$Target/Property[Type="Windows!Microsoft.Windows.OperatingSystem"]/OSVersion$</Value>
</Parameter>
<Parameter>
<Name>StrOSCaption</Name>
<Value>$Target/Property[Type="Windows!Microsoft.Windows.OperatingSystem"]/OSVersionDisplayName$</Value>
</Parameter>
</Parameters>
<ScriptBody><Script>


param($StrOSVersion,$StrOSCaption)

$ErrorActionPreference = "Stop"

# Set up the arguments
$scriptargs = new-object psobject
$scriptargs | add-member NoteProperty "StrOSVersion" $StrOSVersion
$scriptargs | add-member NoteProperty "StrOSCaption" $StrOSCaption

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

# Environment

$scriptenv = New-Object System.Management.Automation.PSObject
$scriptenv | Add-Member NoteProperty "RuntimeError" $false
$scriptenv | Add-Member ScriptProperty "IsWindowsServer2012Env" {([version]$scriptargs.StrOSVersion).Major -eq 6 -and ([version]$scriptargs.StrOSVersion).Minor -eq 2 -and $scriptargs.StrOSCaption -like "*Windows Server 2012 *"}
$scriptenv | Add-Member ScriptProperty "IsHotfix2871777InstalledEnv" {(Get-HotFix | Where-Object{$_.HotFixID -eq "KB2871777"}) -ne $null}


# Main function

function AdvisorRule($scriptargs, $scriptoutput)
{
# All parameters should be populated outside of the main function.
# The main function should only include the detection logic so that it can be easily reused by the Atlanta authoring tool.

trap [Exception] {
$scriptenv.RuntimeError = $true
continue
}

# Initialize parameters
$scriptoutput.HasIssue = $false

# Set parameter values

if($scriptenv.IsWindowsServer2012Env)
{
if($scriptenv.IsHotfix2871777InstalledEnv -eq $false)
{
if($scriptenv.RuntimeError -eq $false)
{
$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)
}

$bag

</Script></ScriptBody>
<SnapIns/>
<TimeoutSeconds>300</TimeoutSeconds>
<Schedule>86393</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>