Page 1 of 1

Patching without write access to TEMP

PostPosted: 23.12.2019, 20:49
by rmorrow815
Hello everyone. New person on the forum but long time user. I ran into an issue where I was unable to install OS patches because the temp directory was limited to read only permissions. I was able to set temp to the wsus directory using the following code in WSUSOS_DIR\cmd\custom\InitializationHook.cmd

Code: Select all
cd "%~dp0"

Patching without access to TEMP

PostPosted: 23.12.2019, 21:04
by rmorrow815
Hello Everyone, New user on forum longtime user. I have been running into issue installing patches using WSUS offline. I found the following code which I am using in wsusou_dir\cmd\custom\InitializationHook.cmd

https://forums.wsusoffline.net/viewtopic.php?f=2&t=6876

Code: Select all
cd "%~dp0..\.."
set WSUSOU_DIR=%cd%
cd "%~dp0"
if not exist "%WSUSOU_DIR%\tmp" (
     exit /b 1
)
set TEMP=%WSUSOU_DIR%\tmp


The problem was that DISM was still trying to write to temp. I was able to make the following change to /ScratchDir wsusou_dir\cmd\InstallOSUpdate.cmd on lines 187 and 189

Code: Select all
if exist %systemRoot%\Sysnative\Dism.exe (
   %systemRoot%\Sysnative\Dism.exe /Online %DISM_QPARAM% /NoRestart /Add-Package /PackagePath:%1 /IgnoreCheck /ScratchDir:%TEMP%
)  else (
   %systemRoot%\System32\Dism.exe /Online %DISM_QPARAM% /NoRestart /Add-Package /PackagePath:%1 /IgnoreCheck /ScratchDir:%TEMP%
)


The question I had was how could this change get put into the main wsusoffline download.

Thanks

Re: Patching without write access to TEMP

PostPosted: 23.12.2019, 22:11
by Dalai
Well, I'm not sure if that's the only change necessary. Other programs/commands used by WSUS Offline could also refer to the original %TEMP% directory instead of the changed one.

But, to answer your question: If the author sees your suggestion as valid and good, it will be added to the trunk (which will end up as WSUS Offline main package eventually).

Regards
Dalai

Re: Patching without write access to TEMP

PostPosted: 23.12.2019, 23:06
by aker
rmorrow815 wrote:I found the following code which I am using in wsusou_dir\cmd\custom\InitializationHook.cmd

https://forums.wsusoffline.net/viewtopic.php?f=2&t=6876

Code: Select all
cd "%~dp0..\.."
set WSUSOU_DIR=%cd%
cd "%~dp0"
if not exist "%WSUSOU_DIR%\tmp" (
     exit /b 1
)
set TEMP=%WSUSOU_DIR%\tmp



The script you use was created for Download only. It must NOT be used for the installation as I cannot tell you for sure, that it's working.

Re: Patching without write access to TEMP

PostPosted: 24.12.2019, 02:27
by rmorrow815
Hmm I did change both together but when I added the scratch space switch it would start to install. I'll test it some more without the code you created to see if I get a positive result. Any suggestions on getting installs to work with directing temp directory to a possible different directory.

Re: Patching without write access to TEMP

PostPosted: 02.03.2020, 23:30
by WSUSUpdateAdmin
Hi.

--------------------------------
/ScratchDir:<Pfad zum Verzeichnis>

Gibt ein temporäres Verzeichnis für die Extrahierung zu wartender
Dateien an. Das Verzeichnis muss vorhanden sein.

Ohne Angabe wird das temporäre Verzeichnis verwendet.
--------------------------------

Doesn't make sense then to specify "/ScratchDir:%TEMP%", does it?

RTW