Exit Codes: The Key to Smooth App Deployments

Exit Codes: The Key to Smooth App Deployments

Introduction

If you have been working with application deployment before, you might have heard about exit codes, or it could be that you've seen them when uploading a Win32 app to Intune.

In this blog, we will take a look at exit codes and how you can use them when you deploy applications with Microsoft Intune. We will mainly focus on the soft and hard reboot exit codes.


What are exit codes?

When you've deployed an application with Intune and it's been successfully installed, it will return an exit code of 0 by default. This can be changed within Intune when you are deploying a Win32 application.

As you can see above, there are also exit codes for soft and hard reboots, and lastly, retry. Let's say I have a program that I need to uninstall and restart the device before I can proceed with the installation of the new program. This is where the exit codes will come in handy! I will show you why now.

What is the difference between soft and hard reboot? With soft reboot, the user get the option to restart the device themselves at a convenient time. However, a hard reboot will be forced, and the user doesn't get to choose.


How do I use exit codes with PSADT?

If you haven't used PSADT before, I highly recommend you take a look at this blogpost; it will give you an introduction to the tool.

Before we can start putting in the code to execute the exit code, we have to decide how we will use it. In our example, we want to uninstall Google Chrome, restart, and then install the newest version.

To start off, I will scroll down to the pre-installation section and input the line that will uninstall Google Chrome.

Once that is done, I will make sure to execute my exit code 3010 (soft reboot), which will make the user aware that a reboot is needed in order to proceed with the installation. You only have to write exit and then your exit code, as shown below.

That was it, then you would have to specify your installation tasks as well. In my case, I would like to install Google again with the newest version.


End-User Experience

When you are using the soft reboot option to deploy applications, the end-users will get the below notification in Windows when it's reached the exit code.

If you take a look in the registry path below, it will show you some interesting information:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\Win32Apps\OperationalState

Before the restart has succeeded, the registry will display "SoftRebootPending".

It is important to remember that when you are using a soft reboot, it is possible to install additional software before you restart the computer.

The hard reboot option will display a slightly different notification to the end users when the installation has finished.

You can also see in the registry that it will display "HardRebootRequired", before the device will reboot.


AppActionProcessor

We've got this shiny log called AppActionProcessor that got a lot of information about application deployment together with AppWorkload.

First of all, it will check if there are any apps available for installation. For this case, we can see that the targeted intent for this app is "AvailableInstall", which means it's available in the company portal.

In the targeted intent line in the log, we can see whether the application is detected, applicability, reboot, etc. There is a lot of useful information here!

A great example with this log is that we can see a soft reboot is currently pending.

If you are unsure where to find the application ID, navigate to Intune and app section. Select the specific app where you would like to find the ID. In the URL, you can see app ID.


Conclusion

Thanks for reading this blog. I hope it gave you some insights on how to use exit codes in your application deployment.