I have, but only for a single HF.
it is integrated in our post install batch, but our admin image is copied and run locally on each workstation.
I cannot guarantee it works running from a unc path.
sw has at least two kind of patches afaik: bat files and self extracting exe.
the first is a case by case and should not be run from the admin Image imho. too risky.
the exe should be run decompessed with the silent flag.
depending on how many machines you have to deploy the hf you may want a log and a error handling to review the install results after the deployment otherwise you shot in the darkness hoping for the best.
HF patches do not need to be uninstalled next time you update sw.
bare minimum is
my approach is:
1. divide the hot fix and the script in a separate folder from the install sw data inside admin image folder like
SW_2023Sp5
Logs
Scripts
clarification update: hf subfolders inside the script folder In which you save your bat file and call it from the admin Image.
2. check the hf files before applying the patch log the result.
hotfix needs one exe file (patcher), one ini file and the patched files inside their subfolders(x64 x32 depending on what they patch).
3. apply the patch and log the result
at this point you may or may not pause the bat and show an error or let the bat continue depending on how you install the admin image and what you want to be done.
pseudo code below out of my head have fun checking if their patch returns an errocode errolevel
Code: Select all
@echo off
setlocal enabledelayedexpansion
set "hotfixpath=yourpathtothefix\"
set "hotfixfile1=hf.exe"
set "hotfixfile2=Files\x64\good.dll"
set "log=mylogpath\log.txt"
cls
echo log initialize >>%log%
echo check files >%log%
call checkfiles
echo check result %myerror% >%log%
if %myerror% GTR 0 (
echo error %myerror% file missing > %log%
exit /b1
)
echo apply patch >%log%
call applyhf
if %myerror% GTR 0 (
echo error %myerror% something wrong here > %log%
exit /b1
)
echo happy end >%log%
exit
:checkfiles
set /A myerror=0
if not exist %hotfixpath%%hotfixfile1% set /A myerror=1
if not exist %hotfixpath%%hotfixfile2% set /A myerror=2
exit /b %myerror%
:applyhf
set /A myerror=0
%hotfixpath%hotfix.exe /s /k >%log%
echo %errorlevel% >%log%
if %errorlevel% GTR 0 set /A myerror=666
exit /b %myerror%
Update Notes:
A batch file run from the admin image must not trigger a dialog or user response otherwise it could fail.
Also the batch runs in a 32 bit console so if you mess with registry be aware of what it implies.
hotfix.exe requires elevation, the admin image must be run as elevated
(this normally happens, but running manually in some enviroiments *could* trigger a non elavated batch)
Hotfix.exe returns an %errorlevel% of
0 success
2 ini file not found
10 patch already applied
19 patch files not found?
it should be safe to assume everything >0 is fail =0 is OK no 100% sure, unsuppressing the result dialogs you get the code 19, but the patch is shown as applied correctly anyway. LOL