Install hotfixes with the admin image

User avatar
Hansjoerg
Posts: 113
Joined: Thu Apr 01, 2021 4:17 pm
Answers: 3
x 71
x 60

Install hotfixes with the admin image

Unread post by Hansjoerg »

Hello to all,

The admin image offers the possibility to run an application after the installation. With this option you can very elegantly roll out a hotfix together with the software.

If it is only one hotfix that is required.
According to my current status, the following hotfixes are required for the SWX 2023 SP 05 version:
HF-1114811; HF-1187397 and HF-1210441 (no guarantee of completeness!)

Has anyone ever tried to install several hotfixes via a *.bat that is started from the Addmina image?

How should such a *.bat be structured? I don't have the experience for this, I'm happy if I get along with the SWX macro programming so slowly.

Does anyone have an example of such a *.bat script?
All the "good" news about SWX makes me feel like I'm driving a truck with two trailers straight into a dead end.
User avatar
mp3-250
Posts: 630
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 697
x 347

Re: Install hotfixes with the admin image

Unread post by mp3-250 »

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

Code: Select all

hotfix.exe /s /k
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
  • - HF1
  • - HF2
  • - ...
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
User avatar
mp3-250
Posts: 630
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 697
x 347

Re: Install hotfixes with the admin image

Unread post by mp3-250 »

I forgot one thing: test it!

Made it FAIL and test it in every possible scenario to see how SW installer reacts and in that case ask yourself what to do to cope with that error. If you have a couple of PCs it is basiallytheir problem, if you need to deploy >10Pcs is likely YOUR BIG problem. So think carefully and test, test, test.

And do not trust admin image tool . It is bugged. =)
Post Reply