I recently had someone contact me that was looking for a way to add a conditional restart to a Task Sequence, but only if an application was successfully installed. Figured this would make a nice blog post, since if someone asked about it, chances are someone else also would like that information.
The first thing we need to do is to set a Task Sequence Variable that we can use for the Restart Computer step.
First, lets create a new Task Sequence variable and call it AppInstalled1 and set it to True.
Next we want to set a condition on the set TS Variable step, so that it only sets the variable to True if the application is installed. In this example, I’m going to check for the existence of something.exe, however you could also use a MSI product code, or check for a folder, or any number of available conditions.
Available options you could use to detect for the installation of software. Most common would be file, folder, registry, or installed software (MSI).
Next, we would add our Restart Computer Task Sequence step. Make sure you configure it to boot into the appropriate OS, be that WinPE or the currently installed OS, depending on where you are running this step. Typically if we are talking about software installs, then we are running in the full OS.
On the Restart Computer Task Sequence step, we need to set a condition that looks for the existence of our custom variable AppInstalled1, being set to True. This way the reboot will only run if we detected the application to be installed and the variable was set to True.
This just a really quick of way of basing a restart task on the condition of a variable. There are other ways to accomplish similar behavior as well.
Hope it helps!