Page 1 of 1

Example of using initscript.cmd with TBWinRE?

Posted: Wed Jun 29, 2016 3:09 am
by PsychBiller
I'd like to use initscript.cmd to run manage-bde to unlock my BitLocker-encrypted partition automatically before launching IFW when booting from a TBWinRE USB drive. What type of scripting language does this use? TBScript? All I want is an example of running an external program. I can't find anything in the forums or the Web site.

Re: Example of using initscript.cmd with TBWinRE?

Posted: Wed Jun 29, 2016 5:05 am
by TeraByte Support(PP)
The InitScript.cmd, RunScript.cmd and BuildScript.cmd files are all standard CMD scripts (batch files).

Assuming you're using TBWinPE/RE Builder and copy your recovery key .BEK file into the TBWinRE build folder, you could set it up as follows.

The BuildScript.cmd file would have a "copy" command to copy the BEK file into the build. (Don't include the ----------- lines.)
----------
copy "%TBWinPE_BuildPath%\BEKFile.bek" "%TBWinPE_MountPath%\Windows\System32"
----------
Of course, use the correct name for the .bek file.

The InitScript.cmd file would contain the manage-bde command to unlock the drive. You need to know the drive letter that gets assigned to the partition you need to unlock when you're booted into TBWinRE (C: is used below). As above, use the correct filename for the .bek file.
----------
%SystemDrive%\Windows\System32\manage-bde.exe -unlock c: -rk "%SystemDrive%\Windows\System32\BEKFile.BEK"
----------

If you want to be prompted for the password instead, you would use the following command:
----------
%SystemDrive%\Windows\System32\manage-bde.exe -unlock c: -pw
----------

In Builder's settings you would need to check the "Include InitScript.cmd" and "Include BuildScript.cmd" options to enable them.

Note: The above method will work when booting from a UFD. If booting to the installed WinRE an alternative method is required.

Re: Example of using initscript.cmd with TBWinRE?

Posted: Wed Jun 29, 2016 5:24 am
by PsychBiller
This is fantastic, Paul. Thank you for such great detail!