Detect reboot required from IS script for .NET 4.8
Hi, I am running IS2019 and am working with an InstallScript project. My test OS is Server 2019.
I am reluctantly (see my other post) utilizing the IS-provided prerequisites to assist in installing some prerequisites,
but I am trying to move away from it, and go back to installing my prereqs in script so I have more control over the number of reboots.
My ultimate goal is to detect reboots if needed for all prereqs, hold off all reboots until the end of the install and also no longer use PRQ's.
I am seeing a problem with .NET 4.8.
If I run the 4.8 installer manually on Server 2019, it always wants to reboot. I don't know why, but it does. That is not the issue (though I'd like to know). But this is my baseline test to determine if a reboot is required.
The PRQ installer also detects that 4.8 needs to reboot, and asks to reboot before my main install starts. All ok.
But when I do it via script, it always returns with a return code of 0, meaning no reboot needed, which I believe is incorrect at this point.
How can I install .NET 4.8 from script if I cannot determine if a reboot is required?
I tried "extracting" the .NET framework from its EXE prison and running THAT, but MS will not allow that setup.exe to be run. It throws an error.
Thanks! Code below.
SdShowMsg("Installing .net 4.8...", TRUE);
result = LaunchAppAndWait(SRCDIR ^ "prereqs" ^ "ndp48-x86-x64-allos-enu.exe", "/norestart /passive", LAAW_OPTION_WAIT);
MessageBox ("Return value from .net 4.8: " + strResult, INFORMATION);
// Return codes: https://docs.microsoft.com/en-us/dotnet/framework/deployment/deployment-guide-for-developers#return-...
if (result == 1602) then
MessageBox ("User cancelled. Aborting install", INFORMATION);
elseif (result == 1603) then
MessageBox ("Fatal error during .net installation, aborting.", INFORMATION);
elseif (result == 5100) then
MessageBox ("Computer does not meet system requirements, aborting.", INFORMATION);
elseif (result == 1641 || result == 3010) then
MessageBox ("Restart required, saving for end of install. Continuing install.", INFORMATION);
BATCH_INSTALL = 1;
Re: Detect reboot required from IS script for .NET 4.8
You could look for the registry value PendingFileRenameOperations under the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager as follows:
function <WhicheverEventHandlerFunctionYouWant> NUMBER nSize, nType; STRING sValue; begin RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); RegDBGetKeyValueEx("SYSTEM\\CurrentControlSet\\Control\\Session Manager","PendingFileRenameOperations", nType, sValue, nSize); // If sValue contains any characters, then a Reboot is pending // If sValue is empty then no Reboot is pending end;