Requirements for adding custom scripts to the Windows PE build process

This topic describes the requirements for adding custom scripts to the creation of the Windows PE image.

LenovoScripting Toolkit uses three variables to control the custom scripts and the time they are run during the SGTKWinPE process: To run a custom script during the SGTKWinPE process, set the appropriate variable to the path of the custom script that you want to run. For more information, see SGTKWinPE user settings.
A template script, Template.cmd, is provided in the BuildScripts directory to use as a base for creating your own custom scripts. At a minimum, any custom script must set the following environment variables on completion:
RC=number
The return code that informs the SGTKWinPE.cmd script file that an error occurred when the custom script file was run. The number 0 indicates success, and any other number indicates an error.
RMSG=message
If RC=number is set to a non-zero value, set the RMSG environment variable to a message that indicates the nature of the error. This message is written to the log file and displayed on the console to indicate the error.