Check for specific VMM hostfixes/patches by looking at file versions
http://go.microsoft.com/fwlink/?LinkID=378174
Target | Microsoft.KnowledgeServices.VMM.2012.VMMServer | ||
Parent Monitor | System.Health.ConfigurationState | ||
Category | Alert | ||
Enabled | True | ||
Alert Generate | True | ||
Alert Severity | Error | ||
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_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>
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 = <value>
# 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
</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>