One of the most confusing and perplexing issues one can run into during OSD is trying to install a ConfigMgr Client Patch during OSD using the PATCH property. While many have developed methods that work for them, none of them really work in ALL situations or are ideal to run in locations with slow links.
Running it from a Remote Share for example means your clients are traversing your WAN links to pull down updates. Depending on how many patches you apply, this could dramatically increase your deployment times. In addition, if your site is on a slow link, it could impact your WAN link availability if you image many machines.
Other methods like to leverage the %_SMSTSMDataPath% variable as seen here. The issue I’ve had with this method is that while the value for %_SMSTSMDataPath% stays static, the Drive Letter where your packages are stored can change during the reboot that the Setup Windows and ConfigMgr step initiates.
For example, if you are in WinPE and your system has 1 HDD. Next, you format the HDD with 2 partitions. 1 Partition for BitLocker, the other the OS. The first partition will be seen as C: by WinPE, the second will be D: or E: (depending if you have an optical drive or not).
%_SMSTSMDataPath% would be assigned the drive letter of D: or E: (Wherever you OS goes) but after that reboot, your OS drive will be set to C: which is where the Windows OS goes (by default).
In order to “fix” this once and for all, I decided to just copy the patch(es) to a static location on the disk as shown below.
First things first, we configure our Format and Partition Disk step to store the Drive Letter to a variable “OSDisk”.
Second, we configure our Apply Operating System Image step to apply the OS to a “Logical drive letter stored in a variable” Here we use the same ‘OSDisk’ variable as above.
We then create a new Run Command Line Step immediately before the Setup Windows and ConfigMgr Step in our Task Sequence. This step will copy the hotfixes from your ConfigMgr Client Package to your local disk.
NOTE: You may need to update the source path according to how you store the hotfixes in the package.
The final step is to append the following string to your Setup Windows and ConfigMgr step:
You can use multiple PATCH statements if needed, but this will apply CU2 for x64 systems.
Lastly, you may want to run another Run Command Line Step to cleanup the C:\hotfix directory once you are all done.