VMMServerFileVersionCheck

Monitor_VMMServerFileVersionCheck (UnitMonitor)

Check for specific VMM hostfixes/patches by looking at file versions

Knowledge Base article:

External

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

Element properties:

TargetMicrosoft.KnowledgeServices.VMM.2012.VMMServer
Parent MonitorSystem.Health.ConfigurationState
CategoryAlert
EnabledTrue
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.KnowledgeServices.Library.PowerShellMonitorEx
RemotableTrue
AccessibilityPublic
Alert Message
VMM isn't running the latest Update Rollup
<Details>
<Content>The specified update or hotfix was not found on the server. VMM may not function correctly or at all without this update. To resolve this issue, download and install the latest update rollup, which is available from Microsoft Update. See the KB article for more information, including a list of fixes in the update rollup.</Content>
<CollectedInformation>
<Info>
<Name>Details</Name>
<Value>{0}</Value>
</Info>
</CollectedInformation>
</Details>
RunAsDefault
CommentSupportTopic=TBD;VersionNumber=1.0.0.0;

Source Code:

<UnitMonitor ID="Monitor_VMMServerFileVersionCheck" Comment="SupportTopic=TBD;VersionNumber=1.0.0.0;" Accessibility="Public" Enabled="true" Target="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" ParentMonitorID="Health!System.Health.ConfigurationState" Remotable="true" Priority="Normal" TypeID="KnowledgeServicesLibrary!Microsoft.KnowledgeServices.Library.PowerShellMonitorEx" ConfirmDelivery="true">
<Category>Alert</Category>
<AlertSettings AlertMessage="MonitorMessage4920e850a7e148a69877d0ed5798d6b2">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Data/Context/Property[@Name='Details']$</AlertParameter1>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<ScriptName>VMMServerFileVersionCheck.ps1</ScriptName>
<Parameters>
<Parameter>
<Name>VMMRelease</Name>
<Value>$Target/Property[Type="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer"]/VMMRelease$</Value>
</Parameter>
<Parameter>
<Name>InstallPath</Name>
<Value>$Target/Property[Type="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer"]/InstallPath$</Value>
</Parameter>
</Parameters>
<ScriptBody><Script>


param($VMMRelease,$InstallPath)

$ErrorActionPreference = "Stop"

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

# Set up the output
$global:scriptoutput = new-object psobject
$scriptoutput | add-member NoteProperty "HasIssue" $false
$scriptoutput | add-member NoteProperty "Details" ""
function AdvisorRule($scriptargs, $scriptoutput)
{
# Here is how you can access your script argument:
# For example: $scriptargs.Argument
# For the list of arguments that are supplied to this script, please refer
# to your rule in the Atlanta Authoring Tool

# Here is how you can add a configuration point value.
# $scriptoutput.ConfigPointA = &lt;value&gt;
# Be sure to add all of the ones that you specified.

$filesToCheck = @();

$vmmFileVersions2012SP1 = @(
@{
Path="bin\AnalysisStoredProc.dll";
Version="3.1.6032.0"
},
@{
Path="bin\ClusterUtil.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Engine.Adhc.Operations.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Engine.BitBos.dll";
Version="3.1.6027.0"
},
@{
Path="bin\Engine.Common.dll";
Version="3.1.6032.0"
},
@{
Path="setup\Engine.Common.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Engine.Deployment.dll";
Version="3.1.6032.0"
},
@{
Path="setup\Engine.Deployment.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Engine.ImgLibOperation.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Engine.IndigoAccessLayer.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Engine.MomDal.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Engine.Placement.dll";
Version="3.1.6027.0"
},
@{
Path="bin\Engine.Placement.ResourceModel.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Engine.ServiceOperations.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Engine.VmOperations.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Errors.dll";
Version="3.1.6032.0"
},
@{
Path="setup\Errors.dll";
Version="3.1.6032.0"
},
@{
Path="bin\GoalState.dll";
Version="3.1.6032.0"
},
@{
Path="bin\ImgLibEngine.dll";
Version="3.1.6032.0"
},
@{
Path="setup\ImgLibEngine.dll";
Version="3.1.6032.0"
},
@{
Path="bin\Remoting.dll";
Version="3.1.6027.0"
},
@{
Path="setup\Remoting.dll";
Version="3.1.6027.0"
},
@{
Path="bin\SCPerfProvider.dll";
Version="3.1.6032.0"
},
@{
Path="setup\SetupVM.exe";
Version="3.1.6032.0"
},
@{
Path="bin\TraceWrapper.dll";
Version="3.1.6027.0"
},
@{
Path="setup\TraceWrapper.dll";
Version="3.1.6027.0"
},
@{
Path="bin\Utils.dll";
Version="3.1.6027.0"
},
@{
Path="setup\Utils.dll";
Version="3.1.6027.0"
},
@{
Path="bin\ViridianImplementation.dll";
Version="3.1.6032.0"
},
@{
Path="bin\ViridianImplementationV2.dll";
Version="3.1.6032.0"
},
@{
Path="bin\VirtualizationInterfaces.dll";
Version="3.1.6018.0"
},
@{
Path="setup\VirtualizationInterfaces.dll";
Version="3.1.6018.0"
},
@{
Path="bin\vmmAgent.exe";
Version="3.1.6032.0"
},
@{
Path="bin\vmmservice.exe";
Version="3.1.6027.0"
},
@{
Path="bin\VMWareImplementation.dll";
Version="3.1.6032.0"
},
@{
Path="setup\VMWareImplementation.dll";
Version="3.1.6032.0"
},
@{
Path="bin\VSImplementation.dll";
Version="3.1.6018.0"
},
@{
Path="setup\VSImplementation.dll";
Version="3.1.6018.0"
},
@{
Path="bin\WSManAutomation.dll";
Version="3.1.6027.0"
},
@{
Path="setup\WSManAutomation.dll";
Version="3.1.6027.0"
},
@{
Path="bin\WsManMIWrappers.dll";
Version="3.1.6018.0"
},
@{
Path="bin\WsManWrappers.dll";
Version="3.1.6027.0"
},
@{
Path="setup\WsManWrappers.dll";
Version="3.1.6027.0"
},
@{
Path="bin\XenImplementation.dll";
Version="3.1.6018.0"
}
);

if ($scriptArgs.VMMRelease.StartsWith("VMM 2012 SP1"))
{
$filesToCheck = $vmmFileVersions2012SP1;
}

$scriptOutput.HasIssue = $false;
$scriptOutput.Details = "";

foreach ($file in $filesToCheck)
{
$fullPath = $scriptargs.InstallPath + "\" + $file.Path;
if (Test-Path $fullPath)
{
$fileItem = Get-Item -Path $fullPath;
$fileVersion = New-Object -TypeName System.Version $fileItem.VersionInfo.FileVersion;
$expectedFileVersion = New-Object -TypeName System.Version $file.Version;
if ($fileVersion -lt $expectedFileVersion)
{
$scriptOutput.HasIssue = $true;
$scriptOutput.Details += $file.Path + " Expected - " + $file.Version + ", Actual - " + $fileItem.VersionInfo.FileVersion + "; ";
}
}
}
}
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.Details -ne $null)
{
$bag.AddValue("Details", $scriptoutput.Details)
}

$bag

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