Home > Cumulative Update 1, Troubleshooting > Cumulative Update 1 – Process flow

Cumulative Update 1 – Process flow

I hope Kevin doesn’t mind me posting this … but this is excellent information from the forums that I think is useful to a wider audience.

Kevin Holman – From the patchlist state view – you can run a task – “Flush Healthservice cache and state” – for any *agents* that are not showing up. It possible they have something stuck in their queue… are sick, etc…

The workflow responsible for populating this is a discovery:

“Discover the list of patches installed on Agents”

It targets Health Service, and runs a script (DiscoverAgentPatches.vbs) every 6 hours. Normally – when a patch is applied – and we bounce the Healthservice – this patch data will be available almost immediately, because this discovery runs on startup. However, if there is a timing issue on that initial run, you should see the patch data on the next run of the script – which will be in 6 hours. If you dont see it after 6 hours, you likely have some issue.

It runs the following script (at the end of post) This script is very simple – it connects to the WIndows Installer scripting object – and requests the patchlist for each patch attached to the MOM agent component ID.

http://msdn.microsoft.com/en-us/library/aa369432(VS.85).aspx

If your isnt working, it might just need the Healthservice bounced again, it might need the HS cache cleared on the agent…. there agent’s OS might have a more serious issue like exhausted resource, broken/disabled Windows installer service, needs a reboot, etc….

You can test this by running it manually.

Find the script by name in your HealthServiceState subdirectories – copy it out to a local directory – and run it manually from a command line:

C:\bin>cscript DiscoverAgentPatches.vbs {00000000-0000-0000-0000-000000000000} {00000000-0000-0000-0000-000000000000} agentname.domain.com

Running this manually should return a blob of XML to the command line which has CU1 in it.

The outcome of the script give you ideas on what to do.

——————————————————

DiscoverAgentPatches.vbs
$MPElement$ $Target/Id$ $Config/ComputerName$

‘ A script that enumerates Software Updates for MOM Agent (not MOM 2005 but higher versions)
‘ For use with Windows Scripting Host, CScript.exe or WScript.exe
‘ Copyright (c) Microsoft Corporation. All rights reserved.
‘ does NOT work agentlessly

Option Explicit

Const msiInstallStateNotUsed = -7
Const msiInstallStateBadConfig = -6
Const msiInstallStateIncomplete = -5
Const msiInstallStateSourceAbsent = -4
Const msiInstallStateInvalidArg = -2
Const msiInstallStateUnknown = -1
Const msiInstallStateBroken = 0
Const msiInstallStateAdvertised = 1
Const msiInstallStateRemoved = 1
Const msiInstallStateAbsent = 2
Const msiInstallStateLocal = 3
Const msiInstallStateSource = 4
Const msiInstallStateDefault = 5

Const momAgentComponentID = “{60ADDA03-1710-4954-B299-A9F42DD889A6}”

Dim oArgs
Set oArgs = WScript.Arguments
if oArgs.Count <> 3 Then
Wscript.Quit -1
End If

Dim SourceId, ManagedEntityId, TargetComputerID

SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
TargetComputerID = oArgs(2)

Dim oAPI, oAgentPatchDiscoveryData
Set oAPI = CreateObject(“MOM.ScriptAPI”)
set oAgentPatchDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)

Call DoPatchDiscovery(oAgentPatchDiscoveryData )
Call oAPI.Return(oAgentPatchDiscoveryData)
WScript.Quit

‘ Connect to Windows Installer object
Function DoPatchDiscovery(ByVal oDisc)
On Error Resume Next
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject(“WindowsInstaller.Installer”) : CheckError

Dim product, productList, count, path, patch, patchList, patchListString, oHealthServiceinstance
On Error Resume Next
Set productList = installer.ProductsEx(“”,””,4) : CheckError

patchListString = “”
For count = 0 to (productList.Count-1)
set product = productList.Item(count)
path = installer.ComponentPath(product.ProductCode, momAgentComponentID)
If path <> “” Then
Set patchList = installer.PatchesEx(product.productCode, “”, 7, 1)
For Each patch In patchList
patchListString = patchListString & patch.PatchProperty(“DisplayName”) & “; ”
Next
End If
Next

Set productList = Nothing

Set oHealthServiceinstance = oDisc.CreateClassInstance(“$MPElement[Name=’SCLibrary!Microsoft.SystemCenter.HealthService’]$”)
With oHealthServiceinstance
.AddProperty “$MPElement[Name=’Windows!Microsoft.Windows.Computer’]/PrincipalName$”, TargetComputerID
.AddProperty “$MPElement[Name=’SCLibrary!Microsoft.SystemCenter.HealthService’]/PatchList$”, patchListString
End With
call oDisc.AddInstance(oHealthServiceinstance)
End Function

Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & ” : ” & Hex(Err) & “: ” & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText
End If
Wscript.Echo message
Wscript.Quit 2
End Sub

Advertisements
  1. July 20, 2010 at 6:10 pm

    Glad to be of assistance.

  1. July 15, 2010 at 7:42 pm

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: