AK224774

Monitor_AK224774 (UnitMonitor)

Virtual host driver detected that can cause stability problems for SQL Server

Knowledge Base article:

External

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

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
Virtual host driver detected that can cause stability problems for SQL Server
<Details>
<Content>There is a virtualization host driver used for storage management on your system that can cause stability problems for SQL Server, such as database consistency errors (823, 824, 605). Upgrade the driver from the manufacturer as soon as possible to the recommended version.
</Content>
<CollectedInformation>
<Info>
<Name>Host driver name</Name>
<Value>{0}</Value>
</Info>
<Info>
<Name>Host driver version</Name>
<Value>{1}</Value>
</Info>
<Info>
<Name>Host driver version to upgrade to</Name>
<Value>{2}</Value>
</Info>
</CollectedInformation>
</Details>
RunAsDefault
CommentSupportTopic=TBD;VersionNumber=1.0.0.0;

Source Code:

<UnitMonitor ID="Monitor_AK224774" 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="MonitorMessage249e2a8208a141aaaca167406ea54201">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Warning</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Data/Context/Property[@Name='DriverName']$</AlertParameter1>
<AlertParameter2>$Data/Context/Property[@Name='DriverCurrentVersion']$</AlertParameter2>
<AlertParameter3>$Data/Context/Property[@Name='DriverRequiredVersion']$</AlertParameter3>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<ScriptName>AK224774.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 "DriverName" ""
$scriptoutput | add-member NoteProperty "DriverCurrentVersion" ""
$scriptoutput | add-member NoteProperty "DriverRequiredVersion" ""
#-------------------------------------------------------------------------------------------
# MAIN CODE SECTION
#-------------------------------------------------------------------------------------------
$scriptenv = new-object psobject
$scriptenv | add-member NoteProperty "RuntimeError" $false
$scriptenv | add-member NoteProperty "FileFullName_XGVHBA" ""
$scriptenv | add-member NoteProperty "FileVer_XGVHBA" "0.0.0.0"
$scriptenv | add-member NoteProperty "IsExistsFile_XGVHBA" $false
$scriptenv | add-member NoteProperty "IsExistsSQLServerEnv" $false

function IsExistsSQLServer()
{
$sqlInstances = Get-WmiObject -Query "Select Name from Win32_Service where PathName like `'%sqlservr.exe%`'"
if($sqlInstances -ne $null)
{
$sqlInstanceCount = ([array]$sqlInstances).Count
if($sqlInstanceCount -gt 0)
{
$scriptenv.IsExistsSQLServerEnv = $true
}
}
}

function GetXGVHBAInfo()
{
$scriptenv.FileFullName_XGVHBA = Join-Path $Env:SystemRoot "System32\drivers\XGVHBA.SYS"
if(Test-Path $scriptenv.FileFullName_XGVHBA)
{
$scriptenv.IsExistsFile_XGVHBA = $true
$scriptenv.FileVer_XGVHBA = [Diagnostics.FileVersionInfo]::GetVersionInfo($scriptenv.FileFullName_XGVHBA).FileVersion
}
}

# Main function

function AdvisorRule($scriptargs, $scriptoutput)
{
trap [Exception] {
$scriptenv.RuntimeError = $true
continue;
}

# 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.

# Initialize parameters
$scriptoutput.HasIssue = $false
$scriptoutput.DriverName = ""
$scriptoutput.DriverCurrentVersion = ""
$scriptoutput.DriverRequiredVersion = ""

# Set parameter values
IsExistsSQLServer

# Detection Logic
if($scriptenv.IsExistsSQLServerEnv -eq $true)
{
GetXGVHBAInfo
if($scriptenv.IsExistsFile_XGVHBA -eq $true)
{
if([version]$scriptenv.FileVer_XGVHBA -ge [version]"2.6.0.0" -and [version]$scriptenv.FileVer_XGVHBA -lt [version]"2.7.3.0")
{
if($scriptenv.RuntimeError -eq $false)
{
$scriptoutput.HasIssue = $true
$scriptoutput.DriverName = $scriptenv.FileFullName_XGVHBA
$scriptoutput.DriverCurrentVersion = $scriptenv.FileVer_XGVHBA
$scriptoutput.DriverRequiredVersion = "2.7.3.0"
}
}
}
}

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

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

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

$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>