The remote script failed with exit code 3010

Hi Support,

When I try to do an Unattended Installation of Microsoft .net Framework 4.7.1, It is failing with the following Error.

“The remote script failed with exit code 3010” . Truth is that this error code “3010” means “A restart is required to complete the install". This message is actually indicative of a success.
But Unfortunately, Octopus Consider this as a Failure and Fails the step. Is there a way resolve this issue?

Thanks,
Anoop

Hi Anoop,

Thanks for getting in touch! This is a bit of a tricky one. Octopus relies on returned exit codes to understand how the deployment/installation went.

The current idea we have for your situation would be to encapsulate the installation here in an attempt to replace the 3010 exit code with a 0 indicating a successful script execution to Octopus.

The following documentation has a section on how Octopus handles errors including some methods to handle errors in Octopus.

Let me know if this helps, or if you have any further thoughts or questions here.

Looking forward to hearing from you. :slight_smile:

Best regards,
Daniel

Hi Daniel,

Thanks for your reply. But I am not sure how to apply that Logic. Following is the Installation part.

Write-Host “Installing .NET 4.7.0”
$ExeFileName= NDP471-KB4033342-x86-x64-AllOS-ENU.exe
$Dir=“E:\Repository\DotNet”
& cmd /c "$Dir$ExeFileName /q /norestart " -Wait -PassThru
if ($LastExitCode -ne 0) {
throw “Installation has been completed…”
}

The Script will Fail at the Installation Line Itself and do not go for the ‘If’ condition. Is that the right method or something else I have to do.

Hi Anoop,

Thanks for the update. I’m sorry for the delay in getting back to you. I believe I may have an answer for you.

Below is a script which we believe should work for you here. This was not tested with the actual installation so our results may be slightly different from yours.

$ErrorActionPreference = "Continue"

Write-Host “Installing .NET 4.7.0”
$ExeFileName= NDP471-KB4033342-x86-x64-AllOS-ENU.exe
$Dir=“E:\Repository\DotNet”

try
{
& cmd /c "$Dir$ExeFileName /q /norestart " -Wait -PassThru
}
catch 
{
if ($LastExitCode -eq 3010) {
   Write-Host "Installation has been completed... (Reboot Pending)"
   $LastExitCode = 0
   }
}

Calamari by default uses $ErrorActionPreference = “Stop” We believe this may have been causing some problems with Octopus breaking as soon as the 3010 code is passed through, however it may be a good idea to confirm that with the actual .NET installation.

Second we have placed the actual execution inside a try/catch. If the installation is as you expect, returning a “successful but requires reboot” 3010 then set the last exit code to 0.

You could play around with this some more as we are not certain that the $ErrorActionPreference = “Continue” is absolutely required if you are using the try/catch.

Let me know how you go here, if this does not work please let me know. :slight_smile:

Best regards,
Daniel

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.