extra .bat (Or .cmd) at the end

extra .bat (Or .cmd) at the end

Postby MikeT » 24.08.2018, 10:09

Hello,

I would like to add an extra "Batch" file at the end so can make som small updates to my os
Is this possible?
MikeT
 
Posts: 1
Joined: 24.08.2018, 10:06

Re: extra .bat (Or .cmd) at the end

Postby Dalai » 24.08.2018, 14:46

Yes, it's already possible. Check out wsusoffline\cmd\custom\*.cmdt and wsusoffline\client\cmd\custom\*.cmdt files respectively. Rename FinalizationHook.cmdt to FinalizationHook.cmd to make them callable by WSUS Offline. You can do whatever you like in there.

Regards
Dalai
Dalai
 
Posts: 1041
Joined: 12.07.2016, 21:00

Re: extra .bat (Or .cmd) at the end

Postby sborisv » 20.11.2018, 21:08

Hi,

I use WSUSOffline as a part of another big script, I run it with two switches: DoUpdate.cmd /all /autoreboot.
All is working well, however i need to continue running my scripts after DoUpdate.cmd finished it's work.

I do not want to customize your scripts, i.e. i do not want to put something mine into "CleanupRecall.cmd".
It is your code, and modifying it will make me a need to customize it again for each your new version of WSUSOffline.

Please what is the way to run some my commands when WSUSOffline has completely finished installing all MS patches?
I have tried to use NO_MISSING_IDS but it obviously does not mean that WSUSOffline finished all, cleanup everything and ready to exit.

Thanks you so much advance,
sborisv
 
Posts: 3
Joined: 19.11.2018, 17:09

Re: extra .bat (Or .cmd) at the end

Postby Dalai » 20.11.2018, 22:10

sborisv,

That's exactly what FinalizationHook is for - see my post above.

Regards
Dalai
Dalai
 
Posts: 1041
Joined: 12.07.2016, 21:00

Re: extra .bat (Or .cmd) at the end

Postby sborisv » 21.11.2018, 01:45

Hi Dalai,

I have put some commads into FinalizationHook and DoUpdate.cmd /all /autoreboot has executed it every server restart.
I.e. DoUpdate.cmd installed first say 25 updates, executed FinalizationHook, reboot server; installed next say 25 updates, executed FinalizationHook and reboot server; and so forth.
Every time before server reboot I have got new record in my log indicating that FinalizationHook has been executed.
Just simple command that I used in FinalizationHook was like echo %time% %date% >>c:\log.txt

However I need something like FinalizationHook but that shall executed one time only, and after DoUpdate.cmd has done all work only.
Do I missed something? Please let me know.

I used the FinalizationHook located at wsusoffline\client\cmd\custom\
sborisv
 
Posts: 3
Joined: 19.11.2018, 17:09

Re: extra .bat (Or .cmd) at the end

Postby Dalai » 21.11.2018, 05:24

Mmh, I thought FinalizationHook would only be called at the very end of the process. But, it's still possible to do, with a slight modification. One could check for the %RECALL_REQUIRED% variable, similar to what is done at the end of DoUpdate.cmd. Maybe like this:
Code: Select all
if "%RECALL_REQUIRED%"=="1" goto :EOF
REM you finalization code here


Regards
Dalai
Dalai
 
Posts: 1041
Joined: 12.07.2016, 21:00

Re: extra .bat (Or .cmd) at the end

Postby sborisv » 22.11.2018, 18:54

Hi Dalai,
Worked, thanks.

if "%RECALL_REQUIRED%"=="1" (
echo %DATE% %TIME% - Info: Some more updates to install >> c:\custom_hook.log
) else (
echo %DATE% %TIME% - Info: All done >> c:\custom_hook.log
)


Thu 11/22/2018 10:38:53.43 - Info: Some more updates to install
Thu 11/22/2018 10:54:33.69 - Info: Some more updates to install
Thu 11/22/2018 11:03:10.30 - Info: Some more updates to install
Thu 11/22/2018 11:57:03.01 - Info: All done
sborisv
 
Posts: 3
Joined: 19.11.2018, 17:09

Re: extra .bat (Or .cmd) at the end

Postby boco » 22.11.2018, 19:01

THis should go into the official release, IMHO. "Finalization hook" tells it all, not to be executed if there are still updates left.
Microsoft update catalog: http://catalog.update.microsoft.com/v7/site/
Windows Install media download: https://support.microsoft.com/en-us/help/15088/windows-create-installation-media
boco
 
Posts: 2391
Joined: 24.11.2009, 17:00
Location: Germany

Re: extra .bat (Or .cmd) at the end

Postby Dalai » 22.11.2018, 21:21

@sborisv:
Glad I could help. TBH I wasn't sure it would work because I haven't tried it myself :D.

@boco:
Yes and no. I agree that it's a good idea to change it, but at the same time it's possible that some people out there rely on the current behavior. If the current behavior is changed, there'll be no way to execute something custom between WOU recalls anymore. What I'm trying to say is that it might be better to provide both options, maybe by introducing a FinalizationHookFinal.cmdt or something that runs after WOU is done, and leave FinalizationHook.cmdt as is.

Regards
Dalai
Dalai
 
Posts: 1041
Joined: 12.07.2016, 21:00

Re: extra .bat (Or .cmd) at the end

Postby boco » 22.11.2018, 21:48

Good argument. Let there be choice!
Microsoft update catalog: http://catalog.update.microsoft.com/v7/site/
Windows Install media download: https://support.microsoft.com/en-us/help/15088/windows-create-installation-media
boco
 
Posts: 2391
Joined: 24.11.2009, 17:00
Location: Germany

Next

Return to Verschiedenes / Miscellaneous

Who is online

Users browsing this forum: No registered users and 6 guests