This week I will do a small post about working with the restart behavior of installations in combination with the Application Model in ConfigMgr 2012. In previous versions there was sometimes a need to use a batch file to catch some weird installation return codes. The nice thing about ConfigMgr 2012 is that it gives us a possibility to specify those return codes and to react on it. In the rest of this post I will show in three steps how to configure ConfigMgr 2012 to work with return (restart) codes.
Step 1: Return codes
The first thing I always do is running the installation of an application a few times and see which return codes it gives me. Based on those experiences I create, if needed, some extra entries in the Return Codes –tab of the Properties of the Deployment Type. By default the following return codes are pre-defined:
- 0 – Success (no reboot)
- 1707 – Success (no reboot)
- 3010 – Soft Reboot
- 1641 – Hard Reboot
- 1618 – Fast Retry
Step 2: Enforce specific behavior
The second thing I do is determining how I think the client should react on the return codes. This can be configured, on the User Experience –tab of the Properties of the Deployment Type, by selecting one of values under Should Configuration Manager enforce specific behavior regardless of the application’s intended behavior?. The following options are available (including small explanation):
- Determine behavior based on return codes – (Default) The client will perform any action needed based on the return code of the application.
- Note: In this case a good configuration in the first step is very important.
- No specific action – The client won’t perform any action.
- Note: In this case it is possible to completely suppress a restart.
- The software install program might force a device restart – The client is told that the installation will force a restart.
- Configuration Manager client will force a mandatory device restart – The client will always perform a restart.
Step 3: Restart behavior
The third, and last, thing I do is more a general client setting. From the moment we decide to restart the device we should think about the configuration of the Computer Restart –settings in the Client Settings. The following Device Settings can be configured:
- Display a temporary notification to the user that indicates the interval before the user is logged of or the computer restarts (minutes) – Default is 90 minutes.
- Display a dialog box that the user cannot close, which displays the countdown interval before the user is logged of or the computer restarts (minutes) – Default is 15 minutes.
The combination of these three steps gives us a lot of options to work with the restart behavior of installations. In most cases the default configuration is perfect, but in some case some tuning is needed. For example, the installation of an application is not allowed at any time. This can be achieved by either configuring a custom return code in the first step, or by specifying No specific action in the second step.
Note: There are also Maintenance Windows and/ or Business Hours, that can influence the restart behavior. I didn’t mention them here, because, yes they can exist, but there should always be a moment that we “touch” a users’ device and this is about that moment.
54 thoughts on “Working with the restart behavior of Applications in ConfigMgr 2012”
hi, nice post thanks! do you know how the client will react during a task sequence to those return code if they’re set to hard reboot or soft reboot?
The task sequence will respond to the exit code of the installation. If the exit code indicates a reboot, the task sequence will reboot.
The following note about “No specific action” is somewhat unclear:
•Note: In this case it is possible to completely suppress a restart
Does this mean that No specific action merely tells ConfigMgr to ignore a restart request by an application installer, or does it have some kind of super-power whereby it can suppress ANY attempt by an application to reboot the system? The note above would seem to indicate that it has the supreme power of suppression, but I think it may be just be inaccurately worded.
I’m just trying to get a definitive answer on this.
It really means what it states. You can change the reaction of the client to a return code of an installer and that includes the reaction to for example a 3010 message of the installer.
To clarify, can it suppress an installer from rebooting a machine? Say, for example, a command line of shutdown -r -t 0? Would it block that? That’s what I’m trying to answer: Can SCCM block a reboot?
No, ConfigMgr can not block every reboot. The only thing it can do is react on exit codes of installers and command lines that are started via the ConfigMgr client.
I have a vbscript as a program. The vbscript does some checks and accordingly returns a value to SCCM 2007. The value can either be 0 or 3010. So, based on my understanding from this article, if i select the option “Program controls reboot” in the After Running drop down options, then SCCM will reboot if program returns 3010, and it wont reboot if the program returns 0.
Yes, your understanding is correct. Do keep in mind that this post is written for ConfigMgr 2012, as it gives you some additional options to change the reaction to a return code.
Thank´s for a good explanation!
I made a transform for msi and filled in the REBOOT = ReallySuppress and did not understand why the computer restarted until I read your blog. It is bad that CM does not cares about what you have typed in the package …
ConfigMgr does care about the configuration, that’s why and how it can respond to the exit code. Because that’s basically all it does, it responds to the exit code of the installation.
Im removing a KB update package with dism using a package. There are other steps after it, but it stops because of the 3010 return code. Is the only way suppressing the reboot to go with TS and select continue with error? As an application requires detection methods, and with packages I can not set behaviour to return codes.
Another method, a bit dirty, is to wrap the update package in a script, catch the exit code and let the script return a different exit code.
I have a custom Powershell script that I am trying to run via a .bat script that wraps the Powershell command. How would I pass back the return code from the powershell script? Do I write back to a COM object or variable, or can I simply just do ‘exit 0’ or ‘exit 3010’ or whatever I like from the .ps1 and it will be automatically picked up by the ConfigMgr 2012 client?
When you wrap the PowerShell script in a .bat file then the ConfigMgr client won’t know anything about the exit code of the PowerShell script. It will only know the exit code of the .bat file.
I have also found that some applications will return a 1641 code and hard reboot the system. This causes the task sequence to prematurely end. We were using the “/qn” command to suppress the UI which does nothing to prevent a reboot. By changing the command to “/quiet /norestart” the task sequence was able to suppress the reboot caused by the 1641 code, thus allowing the task sequence to continue uninterrupted.
Correct. That’s expected behavior.
Lets say you use a script to install the application (PSappdeployment). The script includes 4 modules to be installed in a correct order. When running the script manually it automatically restart after the second module (In the middle of the installation). Will SCCM be able to suppress that reboot? To me it dont seem like the exit code here got anything to say, seeing as the installation never finishes.
Sorry for the late reply. I completely missed out on the notification email. ConfigMgr can only respond to an error code that it receives. If you use a script to start an installation and you use ConfigMgr to start the script, ConfigMgr will respond to the result of the script and not to the result of the installation.
What is the behavior if the application is installed as a dependency, the return code is 3010, and the setting is based on the return code? Does the dependent application wait for the user to allow the reboot, or does it still install right away? If it does wait until the reboot completes, how does this not interrupt the deployment of the primary application? I could see the dependent application not installing until the next enforcement cycle runs and sees that it is still not there.
The 3010 return code will cause the dependent application to wait for the reboot to compleet. That indeed might interfere with the installation behavior that you would like to see. In some case it might be easier to use a task sequence to catch that type of behavior. The most important part is test, test, test. Make sure that you understand the behavior and build on that.
I use a vbscript to run an application with all the return codes you have mentioned set in the return codes tab and Determine behavior based on return codes selected. This script has dependencies which reboots and then the execution of the vbscript starts. It has two commands with noreboot command but while it succesfully runs the first one without any problems it reboots before the installation gets completed for the second command. So could it be a diffcode that i need to put in the return code tab or if i use a cmd that wrap the vbscript with whatever return codes to be presented as success to SCCM that would fix this ?
You need to know the exit code that triggers the restart. Once you know that, you can catch it in your wrapper script. Also, make sure that don’t start your second action before the first one is finished.
dear friend. can i do that with a package? i need restart a pc when the package was finish. with a popup message.
Yes, you can create your own message with custom scripting, or allow the ConfigMgr client to handle the restart message.
I need to prompt the user for a reboot after the installation of one application during task sequence is it possible?
Currently it’s forcing the reboot immediately after the installation is over
What kind of task sequence deployment are you dealing with?
I’m doing windows 10 upgrade task sequence, there’s one application which is blocking the upgrade so I need to uninstall it first
Isn’t that a scenario in which a task sequence is started? In that case the task sequence is already running and showing progress on the screen.
Hi. I’m executing an application deployment via a PowerShell script and exiting with custom exist codes. I have added these Return codes to the Deployment Type Rerurn Codes tab with a description but they are not getting matched either on the client side in Software Center or in the Deployment Status report. The exit codes are being displayed to I’m unsure why they are not being matched to the descriptions. Any ideas?
Are you maybe mixing hex and dec exit codes?
Thank you, Peter for explaining how to supress force reboot!
Hi Peter, are you saying Config Manager accepts hex codes back from powershell scripts? I wasn’t aware this was possible. Any examples?
No, Mark, that’s not what I’m saying 🙂
This was super informative. Thank you!
Do you know of any reason why a return code of 3010 (pendingsoftreboot) would cause devices ignore the reboot behavior set in Client Settings?
My Client Settings are set to 300 minutes initial notification and then 30 minutes of cannot close on the dialog. But, I have one application deployment that returns 3010 (as it should, it needs a reboot), but then does the default of 90 minutes notification and 15 minutes of cannot close.
I have the restart settings on the Default Client Settings – and that setting is not specified in any other client setting.
Did you verify the configuration with the Resultant Client Settings?
I have a question
I have deployed dotnet4.7.1 with the following command in my application
NDP471-KB4033342-x86-x64-AllOS-ENU.exe /q /norestart /ChainingPackage ADMINDEPLOYMENT
if I look at the client logs it’s return code is 3010
The computer still seems to reboot as per the client defaults (in our case 15 minutes)
I have also set the the user experience to “no specific action” with the same results.
Is this normal behaviour? My understanding is that it should not reboot if a return code is 3010 and/or you set the user experience to “no specific action”
thanks in advance
That depends on the configuration of the return codes in your deployment type.
Hi, i just stumbled upon this Post and I also had systems with an”install required” deployment ignoring the suppressed reboot. As far as i understood “no specific action” means ignore wht the package returns.
Reading your last comment you say it depends on the returncode,this confuses me.
Can you clarify what you mean?
With that comment I was referring to the configured code type with the return value. What is the behavior that you’re experiencing?
the System rebooted shortly after it started installing Dell System Administrator on the Server.
Why is that unexpected behavior? What was the exitcode?
Hi peter. I was wondering if you could trigger the reboot message when running the new “run script” option. It could be handy to create a script simply to start the sccm reboot process.
I’m not completely sure what you’re trying to achieve. Is it something like this: https://www.reddit.com/r/SCCM/comments/7spmxs/force_reboot_happy_little_prompt/
Hi Peter, how do you deal with a dependency which returns errorcode 3010? Meaning, i do have an application with a dependency and that dependency returns 3010. The application itself returns usually 0. If i configure both applications as “Determine behavior based on return codes”, there is a “restart” button already after installation of the dependency. If i configure the dependency as “No specific action”, there is no reboot at all. I would like the application also takes the return code of the dependency into account and thus present a reboot button, how to accomplish this?
My first thought would be that something like that would require some custom scripting.
Thank you very much for your reply. Same thoughts on my side, so that is indeed what I have done, in conjunction with the psAppDeploy Toolkit.
That sounds like a good choice, Paul!
Hope you can help, I’m trying to deploy an Available application via SCCM with a reboot exit code 1641, since it’s only set to available and not required I can’t use toast notifications. Is there a way to force a reboot with a let’s say 10 minute timer? So that users have enough time to save their files etc?
With available deployments you can’t force a restart with the standard functionality (see also: https://docs.microsoft.com/en-us/mem/configmgr/core/clients/deploy/device-restart-notifications#restart-notification-types)
We are upgrading drive encryption in our environment and as you know that there are three models for Drive encryption. After installing the last module of this application machine is automatically restarted and is not asking for user consent to reboot the system.
I tried all the logic whit is mentioned above like deployment type property and user experience and change it to configure manager client will force a mandatory device restart.
After all this setting I am not able to get reboot prompt.
Please help me in this.
What is the exit code of the successful installation that triggers the reboot?