Example of using initscript.cmd with TBWinRE?

User discussion and information resource forum for Image products.
Post Reply
PsychBiller
Posts: 61
Joined: Sun Aug 05, 2012 4:45 pm

Example of using initscript.cmd with TBWinRE?

Post 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.
TeraByte Support(PP)
Posts: 1644
Joined: Fri Aug 12, 2011 12:51 am

Re: Example of using initscript.cmd with TBWinRE?

Post 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.
PsychBiller
Posts: 61
Joined: Sun Aug 05, 2012 4:45 pm

Re: Example of using initscript.cmd with TBWinRE?

Post by PsychBiller »

This is fantastic, Paul. Thank you for such great detail!
Post Reply