Menu
CCMEXEC.COM – Enterprise Mobility
  • Home
  • General
  • Configuration Manager
  • Windows 10
  • Windows 11
  • Intune
  • GitHub
  • About
CCMEXEC.COM – Enterprise Mobility

Installing multiple sccm client hotfixes

Posted on April 6, 2011November 16, 2011 by Jörgen Nilsson

When installing the required hotfix for Configuration Manager 2007 R3 you are probably faced with the challenge that you need to install more the one SCCM client hotfix. Installing them in the normal way would require three packages, programs and advertisements which need to be installed.

I wrote a script which will install all hotfixes placed in the same folder as the script I found a great example somewhere on how to write a MIF file which I cannot find again, sorry for not giving you credit for it.

The script will also create the .MIF file needed for Configuration Manager 2007 client to report back succeeded as the Configuration Manager Client hotfixes restarts the client service which makes the advertisement report back “Unexpected reboot”.

*****2011-08-23 – Updated with a new version of the script with improved error control******

Steps to implement the script:

  1. Create a collection to which you will advertise the Client Hotfixes, for instance use a query for all clients not having the latest version, in this example version 4.00.6487.2157.
    Example Query:select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.ClientVersion != “4.00.6487.2157”
  2. Download the sccm client hotfix script from here:https://ccmexec.com/wp-content/uploads/2011/08/updates11.vbs.txt
    It is also posted in the bottom of this page.
  3. Create a package with the script in the source files together with the client hotfixes you would like to install.
    SCCMhotfixes3
  4. For the MIF file to work the package name, version and publisher entered in the script must match the values for the package in SCCM. Change the following lines in the script to match it.
    Call SMSWriteStatusMIF(“Updates.MIF”,“Microsoft”,”SCCM Client Hotfixes”, “2007”,”The operation completed successfully.”,”true”)
    The picture below shows the reporting tab which is made up of the information for the package.
    SCCMhotfixes2
  5. Then create a program for the package according to the screenshot below, don’t forget to select the  “program restarts computer”. Which it will not but it will not report failure when the client service is restarted.  SCCMhotfixes1_red
  6. Then advertise the Program to the collection created in step 1.
    If there are many clients not having the latest version, test the script first on a couple of clients. And as always test and roll out these changes in a controlled way.

Script content:

'Version 1.1 - updated error control and reporting
'Option Explicit
Dim objfso, objShell
Dim folder, files, sFolder, folderidx, Iretval, return

Set objfso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")

sFolder = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))

Set folder = objfso.GetFolder(sFolder)
Set files = folder.Files

For each folderIdx In files
If Ucase(Right(folderIdx.name,3)) = "MSP" then
wscript.echo "msiexec.exe /p " & sfolder & folderidx.name & " /q REINSTALL=ALL REINSTALLMODE=mous"
iretval=objShell.Run ("msiexec.exe /p " & sfolder & folderidx.name & " /q REINSTALL=ALL REINSTALLMODE=mous", 1, True)

If (iRetVal = 0) or (iRetVal = 3010) then

wscript.echo folderidx.name & " Success"
Else
wscript.echo folderidx.name & " Failed"
call SMSWriteStatusMIF("PNITNST.MIF","Microsoft","SCCM Client Hotfixes", "2007",FolderIDX.name & " reported error: " & iretval &" and failed to install","fail")
wscript.quit
End If
End If
Next

call SMSWriteStatusMIF("PNITNST.MIF","Microsoft","SCCM Client Hotfixes", "2007","The operation completed successfully.","true")

Sub SMSWriteStatusMIF(FileName,Manufacturer, Product, Version, Description, bSuccess)
' Writing a status MIF for SWDist to return a success or a failure to execute
' Product is the name of the Script and MIF file.
' Description is the status message
' bSuccess is True/False of success

Const ForWriting = 2
Dim mifFile
Dim WinDir

Set FileSys = CreateObject("Scripting.FileSystemObject")
WinDir = objShell.ExpandEnvironmentStrings("%WINDIR%")
Set mifFile = FileSys.CreateTextFile(WinDir & "\" & FileName , ForWriting)

With mifFile
.Writeline ("START COMPONENT")
.Writeline ("NAME = ""WORKSTATION""")
.Writeline (" START GROUP")
.Writeline (" NAME = ""ComponentID""")
.Writeline (" ID = 1")
.Writeline (" CLASS = ""DMTF|ComponentID|1.0""")

.Writeline (" START ATTRIBUTE")
.Writeline (" NAME = ""Manufacturer""")
.Writeline (" ID = 1")
.Writeline (" ACCESS = READ-ONLY")
.Writeline (" STORAGE = SPECIFIC")
.Writeline (" TYPE = STRING(64)")
.Writeline (" VALUE = """ & Manufacturer & """")
.Writeline (" END ATTRIBUTE")

.Writeline (" START ATTRIBUTE")
.Writeline (" NAME = ""Product""")
.Writeline (" ID = 2")
.Writeline (" ACCESS = READ-ONLY")
.Writeline (" STORAGE = SPECIFIC")
.Writeline (" TYPE = STRING(64)")
.Writeline (" VALUE = """ & Product & """")
.Writeline (" END ATTRIBUTE")

.Writeline (" START ATTRIBUTE")
.Writeline (" NAME = ""Version""")
.Writeline (" ID = 3")
.Writeline (" ACCESS = READ-ONLY")
.Writeline (" STORAGE = SPECIFIC")
.Writeline (" TYPE = STRING(64)")
.Writeline (" VALUE = """ & Version & """")
.Writeline (" END ATTRIBUTE")

.Writeline (" START ATTRIBUTE")
.Writeline (" NAME = ""Locale""")
.Writeline (" ID = 4")
.Writeline (" ACCESS = READ-ONLY")
.Writeline (" STORAGE = SPECIFIC")
.Writeline (" TYPE = STRING(16)")
.Writeline (" VALUE = ""ENU""")
.Writeline (" END ATTRIBUTE")

.Writeline (" START ATTRIBUTE")
.Writeline (" NAME = ""Serial Number""")
.Writeline (" ID = 5")
.Writeline (" ACCESS = READ-ONLY")
.Writeline (" STORAGE = SPECIFIC")
.Writeline (" TYPE = STRING(64)")
.Writeline (" VALUE = ""NIL""")
.Writeline (" END ATTRIBUTE")

.Writeline (" START ATTRIBUTE")
.Writeline (" NAME = ""Installation""")
.Writeline (" ID = 6")
.Writeline (" ACCESS = READ-ONLY")
.Writeline (" STORAGE = SPECIFIC")
.Writeline (" TYPE = STRING(64)")
.Writeline (" VALUE = ""DateTime""")
.Writeline (" END ATTRIBUTE")
.Writeline (" END GROUP")

.Writeline (" START GROUP")
.Writeline (" NAME = ""InstallStatus""")
.Writeline (" ID = 2")
.Writeline (" CLASS = ""MICROSOFT|JOBSTATUS|1.0""")
.Writeline (" START ATTRIBUTE")
.Writeline (" NAME = ""Status""")
.Writeline (" ID = 1")
.Writeline (" ACCESS = READ-ONLY")
.Writeline (" STORAGE = SPECIFIC")
.Writeline (" TYPE = STRING(32)")

' Pass or fail this status mif?
If bSuccess = "true" then
.Writeline (" VALUE = ""Success""")
else
.Writeline (" VALUE = ""Failed""")
End if

.Writeline (" END ATTRIBUTE")
.Writeline (" START ATTRIBUTE")
.Writeline (" NAME = ""Description""")
.Writeline (" ID = 2")
.Writeline (" ACCESS = READ-ONLY")
.Writeline (" STORAGE = SPECIFIC")
.Writeline (" TYPE = STRING(256)")
.Writeline (" VALUE = """ & Description & """")
.Writeline (" END ATTRIBUTE")
.Writeline (" END GROUP")
.Writeline ("END COMPONENT")
End With

mifFile.Close
Set mifFile = Nothing
End Sub
'Package Properties

14 thoughts on “Installing multiple sccm client hotfixes”

  1. Pingback: Twitted by richardlemelin
  2. Pingback: Twitted by Schakespeare
  3. Bastian says:
    August 21, 2011 at 7:45 pm

    Hi Jörgen, thanks for the script! its the perfect method to deploy the numerous hotfixes for the client agent. But i had 2 patches that are not installed because of an error. This patches wasnt reported back as failed. on the client there wasnt a .mif file also. the status of the advertised package was reported as “success” though these hotfixes wasnt installed.
    Is there a way to expand your script so that is get back the failed hotfixes?
    Thanks for your help and work!

    Reply
  4. Jörgen Nilsson says:
    August 23, 2011 at 7:09 am

    Hi,
    I have updated the script now with better error-handling and it will report back to sccm which hotfix failed to install.
    I tested the hotfixes and it seems as kb2278119 is superseeded by another update, the other ones installed just fine for me at least.
    /Jörgen

    Reply
  5. Dennis says:
    August 25, 2011 at 5:12 pm

    Jorgen, thanks so much for your post. This is helping a lot. Your SQL query didn’t work for me (syntax error of some kind), so I set it myself with the following:

    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.ClientVersion < "4.00.6487.2188"

    Obviously this pulls in all systems with agents lower than 2188 and I verified it works on my SCCM setup.

    Reply
  6. Kaishi says:
    September 7, 2011 at 9:50 pm

    Jörgen, thanks for the script. Have you tested using it within a Task Sequence?

    I followed your instructions, but instead of changing the script to use “updates.mif”, I instead specified the default filename within the package (“PNITNST.MIF”). I made sure that the restart settings matched your instructions. Then I created the program, distributed to the DPs, etc. Would you clarify this part of the instructions, please?

    In my Task Sequence, I added a “Install Software” step just after “Setup Windows and ConfigMgr”, selected the correct package and program. When executing this Task Sequence, it errors out after the script starts to run, probably after the first MSP finishes, and the client restarts. I checked the various log files after the TS failed, and noticed the error pointed to “Unexpected restart” even though the program is marked as “Program will restart the computer”. Any ideas?

    Reply
  7. Kaishi says:
    September 8, 2011 at 4:40 pm

    I did a bit more troubleshooting relative to the issue I already described, with help from Microsoft no less. Here’s what I’ve found:

    Running this script within a Task Sequence seems to cause a disconnect between the SCCM Client service (ccmexec) and the Task Sequence processor (smsts), because smsts is constantly polling ccmexec. When the MSP is installed in this manner, and ccmexec restarts, smsts assumes the worst. If you set the “ignore errors and continue” flag within the task sequence, when ccmexec restarts the first time, the rest of that step is considered to have already errored, even if the script is still running and more patches are being applied, so the system will begin any subsequent steps… and then ccmexec will restart again from the next MSP as it is applied… the result is, any number of later steps (likely Software Distribution steps at that stage) will simply fail, as they cannot be performed without ccmexec running.

    I’m looking for a solution. Namely, some way for smsts to avoid moving forward through the deployment until cscript has finished processing this. That or maybe some kind of sleep function. Alternatively, I’ll have to deploy each MSP manually through the Task Sequence.

    Reply
  8. Michael says:
    November 2, 2011 at 7:11 pm

    Thanks, this was extremely helpful. I made some modifications for use within my environment to also have the script install .msi hotfixes using a Case statement as well as outputting a log to %windir%\temp for troubleshooting purposes.

    I wanted to point out that in the sub statement, a value is defined Dim WinpDir and then later used as WinDir. Not a big deal since option explicit isn’t invoked.

    Reply
  9. christian says:
    November 8, 2011 at 2:33 pm

    Hi Jörgen,

    first of all, very good blog, i like it! 😉
    Relating to the installation problems of kb2278119, just take a look at my posting on: http://social.technet.microsoft.com/Forums/en-ZA/configmgrsetup/thread/ef98ef91-62f2-442f-b9fc-338d9ffbcc93

    Perhaps interesting for you too.

    Regards,
    Christian

    Reply
  10. Jörgen Nilsson says:
    November 16, 2011 at 7:27 am

    Thanks for pointing that out, I have updated it.

    /Jörgen

    Reply
  11. Pingback: Build and Capture + Software Updates in Native mode « sccm.haas.se
  12. Karl says:
    April 2, 2012 at 11:02 am

    Thanks for this great post! I tried it with one pc (mine for instance) and everything went smoothly!
    Was a bit sceptical when I saw my ‘site mode’ to ‘unknown’ but the process wasn’t quite finished. But everything went automatically and I had nothing to do.
    Again, great post and it saved me from making 4 separated packages ;-)))))

    Reply
  13. Pingback: My own SCCM Collection | Installing multiple sccm client patches
  14. Pingback: Fidelity Consulting » Build and Capture + Software Updates in Native mode

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

My name is Jörgen Nilsson and I work as a Senior Consultant at Onevinn in Malmö, Sweden. This is my blog where I will share tips and stuff for my own and everyone elses use on Enterprise Mobility and Windows related topics.
All code is provided "AS-IS" with no warranties.

Recent Posts

  • New settings in Intune Security Baseline Windows 11 24H2 -2504
  • Managing extensions in Visual Studio Code
  • Reinstall a required Win32app using remediation on demand
  • Administrator protection in Windows 11 – First look
  • Remediation on demand script – ResetWindowsUpdate
©2025 CCMEXEC.COM – Enterprise Mobility | WordPress Theme by Superb Themes
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Reject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT