In Microsoft MDT how to I reference another Task Sequence based on the previous Error code?
Trying to install VDA via Task Sequence. As per Citrix documentation.
"If a return code is 3, restart the machine and then pass control to SCCM TASK3." How is that done. Below is from the Citrix Docs.
Example installation sequence using SCCM The following example shows the installation sequence.
SCCM TASK1: Prepare the machine by restarting the machine.
SCCM TASK2:Start the VDA installation. Add the /quiet, /noreboot, and /noresume options to your command line options. Run the VDA installer of your choice (local image or one of the minimal installers). SCCM must capture the return code. If the return code is 0 or 8, the installation is complete, and a restart is needed. If a return code is 3, restart the machine and then pass control to SCCM TASK3.
SCCM TASK3:Continue VDA installation. If SCCM TASK2 does not return a 0 or 8, the installation must be continued after the restart completes.
SCCM TASK3 repeats until the VDA installer returns a 0 or 8 (indicating a successful installation), or 3 (indicating SCCM TASK3 must be repeated). Treat any other return code as an error, and SCCM TASK3 should report an error and stop. Resume the VDA installation by running the appropriate VDA installer (XenDesktopVdaSetup.exe for most cases, or XenDesktopRemotePCSetup.exe if VDAWorkstationCoreSetup_XXXX.exe was used) from the location where it was copied (as described in Define the task sequence), with no command-line parameters. (The VDA installer uses the parameters it saved during the first run of the installer.) Watch for the return code from the VDA installer. 0 or 8: Success, installation complete, restart required. 3: Installation is not complete. Restart the machine and repeat SCCM TASK3 until a 0 or 8 is returned. Treat any other return code as an error, and SCCM TASK3 should report an error and end.
In general in a TS the return code of the last step is saved in _SMSTSLastActionRetCode
(Task sequence variables documentation)
So you can include a step afterwards with a condition based on the value of the TS variable. You will probably also need to mark the original TS step as "Continue on Error" because I think any return code other than 0 (and maybe 3010) is treated as error and only on a "Run Command Line" step you can specify different allowed return codes.
That being said as general information I am not sure what to make of those citrix instructions. To me it reads as: If it is 0 or 8 reboot if it is 3 reboot as well. And if you have a reboot between Step 2 and 3 the "Last Execution" might be the reboot so it could be that you have to put that stuff in a group. (Also it is in my personal opinion a little bit ridiculous to think if a vendor has a setup that lacking in robustness that a TS setup can offer the complexity to fix this. I would rather try to get my systems into a state where the return value can never be 3 (whatever that means, probably rebooting before?) and then have 99% system returning 0 and fix my 1% by hand. MY feeling would be that if there can really be that many failures they might also not always be perfectly remedied by that method (if they know how to fix it why does it fail?) and the instruction "repeat SCCM TASK3 until a 0 or 8 is returned" to me reads as if it will only lead to some machine entering an infinite loop at one point...