AK144661

Monitor_AK144661 (UnitMonitor)

Missing KB979231

Knowledge Base article:

External

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

Element properties:

TargetMicrosoft.KnowledgeServices.Windows.OperatingSystem
Parent MonitorSystem.Health.ConfigurationState
CategoryAlert
EnabledTrue
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.KnowledgeServices.Library.PowerShellMonitorEx
RemotableTrue
AccessibilityPublic
Alert Message
Windows operating system missing update KB979231 to prevent memory leak in SQL Server
<Details>
<Content>You are missing Windows Update KB979231. This update addresses a known issue that leads to memory leak in applications like SQL Server. This issue occurs only after you install the Windows Extended Protection package. For every login attempt to SQL Server, a fixed amount of memory is leaked by Schannel in the process heap. Apply the update from KB979231 or any Windows hotfix that includes this fix. See the Knowledge Base article for more information on how to address this issue.
</Content>
<CollectedInformation>
<Info>
<Name>Current 32-bit SCHANNEL.DLL file version</Name>
<Value>{0}</Value>
</Info>
<Info>
<Name>Required 32-bit SCHANNEL.DLL file version</Name>
<Value>{1}</Value>
</Info>
<Info>
<Name>Current 64-bit SCHANNEL.DLL file version</Name>
<Value>{2}</Value>
</Info>
<Info>
<Name>Required 64-bit SCHANNEL.DLL file version</Name>
<Value>{3}</Value>
</Info>
</CollectedInformation>
</Details>
RunAsDefault
CommentSupportTopic=TBD;VersionNumber=1.0.0.0;

Source Code:

<UnitMonitor ID="Monitor_AK144661" 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="Normal" TypeID="KnowledgeServicesLibrary!Microsoft.KnowledgeServices.Library.PowerShellMonitorEx" ConfirmDelivery="true">
<Category>Alert</Category>
<AlertSettings AlertMessage="MonitorMessage7c52693695bb4c5997f208007b85a055">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Warning</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Data/Context/Property[@Name='schannelVersion32']$</AlertParameter1>
<AlertParameter2>$Data/Context/Property[@Name='schannelRequiredVersion32']$</AlertParameter2>
<AlertParameter3>$Data/Context/Property[@Name='schannelVersion64']$</AlertParameter3>
<AlertParameter4>$Data/Context/Property[@Name='schannelRequiredVersion64']$</AlertParameter4>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<ScriptName>AK144661.ps1</ScriptName>
<Parameters>
<Parameter>
<Name>osArch</Name>
<Value>$Target/Property[Type="MicrosoftKnowledgeServicesWindowsLibrary!Microsoft.KnowledgeServices.Windows.OperatingSystem"]/OSArchitecture$</Value>
</Parameter>
</Parameters>
<ScriptBody><Script>


param($osArch)

$ErrorActionPreference = "Stop"

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

# Set up the output
$global:scriptoutput = new-object psobject
$scriptoutput | add-member NoteProperty "HasIssue" ""
$scriptoutput | add-member NoteProperty "schannelVersion32" ""
$scriptoutput | add-member NoteProperty "schannelRequiredVersion32" ""
$scriptoutput | add-member NoteProperty "schannelVersion64" ""
$scriptoutput | add-member NoteProperty "schannelRequiredVersion64" ""
#-----------------------------------------------------
# Environment
#-----------------------------------------------------

$scriptenv = new-object psobject

$scriptenv | add-member ScriptMethod "GetOsVersion" -value {
(Get-WmiObject Win32_OperatingSystem).Version
}

$scriptenv | add-member ScriptMethod "GetOsServicePackVersion" -value {
(Get-WmiObject Win32_OperatingSystem).ServicePackMajorVersion
}

$scriptenv | add-member ScriptMethod "GetWindowsFolder" -value {
(Get-WmiObject Win32_OperatingSystem).WindowsDirectory
}

$scriptenv | add-member ScriptMethod "GetSchannelPath1" -value {
$this.GetWindowsFolder() + "\system32\Schannel.dll"
}

$scriptenv | add-member ScriptMethod "GetSchannelPath2" -value {
$this.GetWindowsFolder() + "\SysWOW64\Schannel.dll"
}

function GetFileVersionInfo($filepath) {
[System.Diagnostics.FileVersionInfo]::GetVersionInfo($filepath)
}


#-----------------------------------------------------
# Helper Function
#-----------------------------------------------------

function TestFile($schannel_file_path, $result)
{
$ServicePackVersion = $scriptenv.GetOsServicePackVersion()
$result.HasIssue = 0
$result.CurrentVersion = ""
$result.RequiredVersion = ""

# check if the file exists
if ( Test-Path -Path $schannel_file_path )
{
# extract the file version information for this file
$schannel_file_info = GetFileVersionInfo($schannel_file_path)
if ( $schannel_file_info -ne $null )
{
# this portion contains checks for [Windows Vista SP1 or Windows 2008 SP1 specific check - remember SP1 code base was actually shipped as RTM for Win 2008]
if ($ServicePackVersion -eq 1)
{
# check for LDR servicing branch fix details
# we need to check if the file version is between 6.0.6001.22450 (inclusive) and 6.0.6001.22613
# we want to do strict version check to align with OS and SP specific builds
if ( ($schannel_file_info.ProductMajorPart -eq 6) -and ($schannel_file_info.ProductMinorPart -eq 0) -and ($schannel_file_info.ProductBuildPart -eq 6001) -and ( ($schannel_file_info.ProductPrivatePart -ge 22450) -and ($schannel_file_info.ProductPrivatePart -lt 22613) ) )
{
# generate the alert
# collect the following information to project in the "information collected" section of the Alert description
$Current_File_Version = ($schannel_file_info.ProductMajorPart).ToString() + "." + ($schannel_file_info.ProductMinorPart).ToString() + "." + ($schannel_file_info.ProductBuildPart).ToString() + "." + ($schannel_file_info.ProductPrivatePart).ToString()
$Required_File_Version = "6.0.6001.22613"
# debug
#Write-Host "Fire alert for : " $schannel_file_path.ToString()
#Write-Host "Current File ver: " $Current_File_Version.ToString()
#Write-Host "Require File ver: " $Required_File_Version.ToString()
$result.HasIssue = 1
$result.CurrentVersion = $Current_File_Version.ToString()
$result.RequiredVersion = $Required_File_Version.ToString()
}
# check for GDR servicing branch fix details
# we need to check if the file version is between 6.0.6001.18272 (inclusive) and 6.0.6001.18490
# we want to do strict version check to align with OS and SP specific builds
if ( ($schannel_file_info.ProductMajorPart -eq 6) -and ($schannel_file_info.ProductMinorPart -eq 0) -and ($schannel_file_info.ProductBuildPart -eq 6001) -and ( ($schannel_file_info.ProductPrivatePart -ge 18272) -and ($schannel_file_info.ProductPrivatePart -lt 18490) ) )
{
# generate the alert
# collect the following information to project in the "information collected" section of the Alert description
$Current_File_Version = ($schannel_file_info.ProductMajorPart).ToString() + "." + ($schannel_file_info.ProductMinorPart).ToString() + "." + ($schannel_file_info.ProductBuildPart).ToString() + "." + ($schannel_file_info.ProductPrivatePart).ToString()
$Required_File_Version = "6.0.6001.18490"
# debug
#Write-Host "Fire alert for : " $schannel_file_path.ToString()
#Write-Host "Current File ver: " $Current_File_Version.ToString()
#Write-Host "Require File ver: " $Required_File_Version.ToString()
$result.HasIssue = 1
$result.CurrentVersion = $Current_File_Version.ToString()
$result.RequiredVersion = $Required_File_Version.ToString()
}
}
# this portion contains checks for [Windows Vista SP2 or Windows 2008 SP2 specific check - remember SP2 is the first service pack after RTM for Win 2008]
if ($ServicePackVersion -eq 2)
{
# check for LDR servicing branch fix details
# we need to check if the file version is between 6.0.6002.22152 (inclusive) and 6.0.6002.22321
# we want to do strict version check to align with OS and SP specific builds
if ( ($schannel_file_info.ProductMajorPart -eq 6) -and ($schannel_file_info.ProductMinorPart -eq 0) -and ($schannel_file_info.ProductBuildPart -eq 6002) -and ( ($schannel_file_info.ProductPrivatePart -ge 22152) -and ($schannel_file_info.ProductPrivatePart -lt 22321) ) )
{
# generate the alert
# collect the following information to project in the "information collected" section of the Alert description
$Current_File_Version = ($schannel_file_info.ProductMajorPart).ToString() + "." + ($schannel_file_info.ProductMinorPart).ToString() + "." + ($schannel_file_info.ProductBuildPart).ToString() + "." + ($schannel_file_info.ProductPrivatePart).ToString()
$Required_File_Version = "6.0.6002.22321"
# debug
#Write-Host "Fire alert for : " $schannel_file_path.ToString()
#Write-Host "Current File ver: " $Current_File_Version.ToString()
#Write-Host "Require File ver: " $Required_File_Version.ToString()
$result.HasIssue = 1
$result.CurrentVersion = $Current_File_Version.ToString()
$result.RequiredVersion = $Required_File_Version.ToString()
}
# check for GDR servicing branch fix details
# we need to check if the file version is between 6.0.6002.18051 (inclusive) and 6.0.6002.18269
# we want to do strict version check to align with OS and SP specific builds
if ( ($schannel_file_info.ProductMajorPart -eq 6) -and ($schannel_file_info.ProductMinorPart -eq 0) -and ($schannel_file_info.ProductBuildPart -eq 6002) -and ( ($schannel_file_info.ProductPrivatePart -ge 18051) -and ($schannel_file_info.ProductPrivatePart -lt 18269) ) )
{
# generate the alert
# collect the following information to project in the "information collected" section of the Alert description
$Current_File_Version = ($schannel_file_info.ProductMajorPart).ToString() + "." + ($schannel_file_info.ProductMinorPart).ToString() + "." + ($schannel_file_info.ProductBuildPart).ToString() + "." + ($schannel_file_info.ProductPrivatePart).ToString()
$Required_File_Version = "6.0.6002.18269"
# debug
#Write-Host "Fire alert for : " $schannel_file_path.ToString()
#Write-Host "Current File ver: " $Current_File_Version.ToString()
#Write-Host "Require File ver: " $Required_File_Version.ToString()
$result.HasIssue = 1
$result.CurrentVersion = $Current_File_Version.ToString()
$result.RequiredVersion = $Required_File_Version.ToString()
}
}
}
}
}

#-----------------------------------------------------
# Main User Function
#-----------------------------------------------------
function AdvisorRule($scriptargs, $scriptoutput)
{
#using a temporary object to store reasults for each file we check
$result = new-object psobject
$result | add-member NoteProperty "HasIssue" 0
$result | add-member NoteProperty "CurrentVersion" ""
$result | add-member NoteProperty "RequiredVersion" ""

# get the Windows OS information
$OSVersion = $scriptenv.GetOsVersion()

$schannel1 = $scriptenv.GetSchannelPath1()
$schannel2 = $scriptenv.GetSchannelPath2()

# This rule is only applicable for Windows Vista and Windows Server 2008 operating systems
if ( $OSVersion -like "6.0.*" )
{
# we need to check the file version of schannel

if ($scriptargs.osArch -eq "64")
{
#in 64 bit environments the system32 computer contains the 64 bit version, wow contains 32
TestFile $schannel2 $result
$scriptoutput.HasIssue = $result.HasIssue
$scriptoutput.schannelVersion32 = $result.CurrentVersion
$scriptoutput.schannelRequiredVersion32 = $result.RequiredVersion

TestFile $schannel1 $result
if ($result.HasIssue -eq 1)
{
$scriptoutput.HasIssue = $result.HasIssue
}
$scriptoutput.schannelVersion64 = $result.CurrentVersion
$scriptoutput.schannelRequiredVersion64 = $result.RequiredVersion
}
else
{
TestFile $schannel1 $result
$scriptoutput.HasIssue = $result.HasIssue
$scriptoutput.schannelVersion32 = $result.CurrentVersion
$scriptoutput.schannelRequiredVersion32 = $result.RequiredVersion
$scriptoutput.schannelVersion64 = ""
$scriptoutput.schannelRequiredVersion64 = ""
}
}
}


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.schannelVersion32 -ne $null)
{
$bag.AddValue("schannelVersion32", $scriptoutput.schannelVersion32)
}

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

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

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

$bag

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