Matt's ConfigMgr blog

Config Manager, System Center products, scripts and other stuff i find interesting.

Automatically populate the SCCM Client Patch property during OSD

This script is based on one written by Michael Murgolo as described here http://blogs.technet.com/b/deploymentguys/archive/2010/08/13/automatically-populate-the-patch-property-for-the-configmgr-2007-client-installation.aspx

I will not repeat everything in that post since most of it is true about my script as well, I will only describe the differences and show how to use it in a normal SCCM OSD.

They main differences between Michaels and mine are:

  • Hotfixes are installed in order based one numbers. So my script installs KB2000 after KB98 where Michael’s would do the opposite.
  • I always assume that the OS-disk will end up as C:, Michael’s script would not work if you had a Bitlocker partition during WinPE that was C: and OS as D: which then would become C: only after system had booted into “full OS”.
  • You have the ability to exclude hotfixes with my script
  • Limitation: The Hotfixes must all be located in a folder starting with “KB”, if this is not true that hotfix will be ignored.

If any of these are an issue for you I recommend using Michael’s original script instead.

To use the script the following two files must be copied to the root of your SCCM Client folder:
SCCMClientHotfixPath.wsf (provided in this post)
ZTIUtility.vbs (from the MDT scripts folder)

After those have been put there you must update your package (default name “Microsoft Configuration Manager Client Upgrade 4.0 ALL”). NOTE: Sometimes after updating this package I get and error during OSD that indicates there is a hash error on the package, to resolve that simply delete the package from all distribution points and re-add it.

The only configuration you might need to do is if you want to exclude any hotfixes during OSD installation. I have had some problem with some patches giving me a 1603 error if installed during OSD. To exclude these you must edit the script itself:

   1: 'Exclude the patches you dont want here:
   2: 'Use syntax:
   3: '    sSMSClientHotfixExcludeList.Add "HF_ExcludeKB001", "KB977203"
   4: '    sSMSClientHotfixExcludeList.Add "HF_ExcludeKB002", "KB978345"
   5:  
   6:  
   7:     sSMSClientHotfixExcludeList.Add "HF_ExcludeKB001", "KB977203"
   8:     sSMSClientHotfixExcludeList.Add "HF_ExcludeKB002", "KB979199"
   9:     sSMSClientHotfixExcludeList.Add "HF_ExcludeKB003", "KB982203"
  10:     sSMSClientHotfixExcludeList.Add "HF_ExcludeKB004", "KB2536089"

If you need another exclusion just add a new line and remember to increment the HF_ExcludeKB00X number by one or remove the ones already there. Also make sure you update your Client package after you do any changes.

To use it you must add two new steps in your TS just before your “Setup Windows and ConfigMgr”.

ClientPatch2

The first step should be a Task sequence variable (Add/General/Set task sequence variable).

ClientPatch3

Name: Set TS Var SMSClientInstallProperties
Task Sequence Variable: SMSClientInstallProperties (Must be exactly this)
Value: <Here you add your normal setup parameters from “Setup Windows and ConfigMgr” but make sure you exclude any patch properites>

Next step runs the script and should be a Run Command Line (Add/General/Run Command Line).

ClientPatch4

Name: Set ConfigMgr Client Patch Properties
Command line: cscript.exe SCCMClientHotfixPath.wsf
Package: Microsoft Configuration Manager Client upgrade 4.0 ALL (or your SCCM Client package)

Last step should be the original “Setup Windows and ConfigMgr”

 ClientPatch5 

Here you must make sure that you have removed everything in the “Installation Properties” (anything entered here should have been moved to the first step).

Next time you run your TS it should have all the patches installed! If something is unclear make sure it haven't been answered in Michael’s post first, otherwise just add a comment and I will try to clarify.

As always, use on your own risk, make sure you test first and don’t blame me when it goes wrong Winking smile

Comments

MarkKent said:

Nice write up, works great!

# March 8, 2012 2:43 PM