Setup PCPC setup
This setup adds a **“Restore with Image for Windows”** command to the classic Windows context menu for `.tbi` files. Selecting the .tbi file passes that image’s path to PowerShell, which fills in an IFW run file and asks TBWinPE/RE Builder to boot into a recovery environment and run the restore. This differs from other restore methods because there is nothing that needs to be edited before every restore. Edit the files in this guide once, then simply select a .tbi file you want to restore. Everything else is done automatically.

**Important: this is configured to restore automatically.** The template names a particular target disk and several partitions, and includes `/uy`; TeraByte describes `/uy` as suppressing the overwrite confirmation in an automated restore. A wrong target disk, partition selection, or image can overwrite data. Make a current backup of anything important, and confirm the target and partition choices before using this from the context menu.
This guide assumes you installed Image for Windows in its default location (C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\). If you did not install in that location you’ll need to adjust the below three files accordingly.
###The Three Files
IFWRestoreReg.reg:
---
---
Restore-TBI.ps1:
---
---
restore-template.ifw:
---
-–
### What each file does
**`IFWRestoreReg.reg`** registers the context-menu entry. The menu label is “Restore with Image for Windows,” and the command launches Windows PowerShell with the selected file path (`%1`) as the script’s argument. The registry command points to `C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\Restore-TBI.ps1`, so that script must be at exactly that location—or you must change the registry entry to match where you put it.
**`Restore-TBI.ps1`** receives the selected `.tbi` path as `$Image`. It then:
1. Stops on PowerShell errors.
2. Checks that the selected image exists.
3. Reads `restore-template.ifw`.
4. Requires the template to contain `__IMAGE__`, then substitutes the selected image’s path for that placeholder.
5. Writes the completed run file to `N:\restore-selected.ifw`. This is a temporary run file passed on to TBWinPE.exe that actually restores your .tbi file after reboot and outside of Windows. N:\ is a temp location. If you do not have an N:\ partition within Windows change it to a partition you do have., other than C:\. The script just needs a temporary location to write the restore-selected.ifw file.
6. Starts `TBWinPE.exe` with the run file and exits with the builder’s return code.
The paths are hard-coded. In particular, `N:` must be a usable, writable location for the account running the script, and the template and builder must exist at the specified paths. A mapped drive letter may not be available in an elevated process, so verify that `N:` works in the same context as the context-menu command. Also check whether an existing `restore-selected.ifw` could be overwritten.
**`restore-template.ifw`** is the IFW command file. `/r` requests a restore; `/f:"__IMAGE__"` is the image-file argument, replaced by the selected file path. The `/d:` value and `/sp:` list specify the target and partition-related choices for this restore. Confirm that they identify the intended disk and partitions on *your* machine; don’t assume the GUID or partition numbers are correct just because they appear in the example. The `/d:` value and `/sp:’ values need to be customized for your system. Initiate an IFW restore process without completing it. Select your disk and partitions to restore. During the process, you’ll see the “show command” button. DO NOT CLICK “START.” Click that and you’ll get the values for your specific `/d:` and `/sp:’ values.

Other switches add restore behavior. For example, /rb:4` is a reboot setting; returning to Windows after the restore. `/quiet` is passed to the builder. The `/opw` value in the supplied template stores your hashed password needed for the .tbi file. Only you know that, so edit the /opw: switch to your needs. If there is no password, just delete the switch.
### How to set it up and use it
1. **Check the assumptions first.** Confirm that your IFW installation really has `TBWinPE.exe` at the configured path, that the template and PowerShell script are in the paths named above, and that the destination disk/partition selections match the disk you intend to restore. Confirm that `N:` is available and writable. The example paths are not universal; many installations use different folders. Change if needed.
2. **Review the restore settings before registering the shortcut.** In particular, verify `/d:`, `/sp:`, the image path handling, and any password-related setting.
3. **Save the files in the locations the registry entry expects.** Save the PowerShell script as `C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\Restore-TBI.ps1` and the template as `C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\restore-template.ifw`, or edit the script and registry command to point to your actual locations. Save the `.reg` file as plain text with a `.reg` extension.
4. **Import the registry file.** Merge `IFWRestoreReg.reg` into the registry using an administrator account and accept the confirmation prompts. The `HasLUAShield` entry requests a shield indicator, but don’t treat the icon by itself as proof that the command will run elevated. Test that PowerShell and TBWinPE actually run with the permissions they need before relying on this for a restore.
5. **Test the path without risking a restore.** First verify that right-clicking a `.tbi` file shows the new entry and that the selected image path reaches the script correctly. Before allowing the restore to proceed, inspect the generated `N:\restore-selected.ifw` and confirm that the substituted image path and every target selection are exactly right. Because this command is designed for an automated restore, don’t click it on an image unless you are ready for the specified target to be overwritten.
6. **Run it only when ready.** Right-click the intended `.tbi` file, choose **Restore with Image for Windows**, and allow the machine to restart into the TeraByte recovery environment. Keep the computer powered and don’t interrupt the process. After completion, it may reboot back into Windows according to the `/rb:4` setting.
A `.tbi` file can contain a full partition or disk image; this is not merely a command to browse or extract files. If your goal is to retrieve a few files rather than restore a partition, use IFW’s file-browsing or file-extraction workflow instead.
IMPORTANT NOTES:
Everything between the dashes (-–) is the code for the needed files. Do not include the dashes in the files’ content
/ohd = Assume original harddrive
/trim = Use this option to TRIM the target area of the restore/destination drive prior to restoring the image.
/rb:4 = Reboot without completion message or reboot message, error cancels reboot. (Auto-Reboot upon completion
/opw: = Hashed password, unique to your .tbi file
/uy= tells Image for Windows to assume the answer to all Yes/No prompts is Yes, the answer to all OK/Cancel messages is OK, and the answer to all Abort/Retry/Ignore prompts is Ignore.
This guide assumes you have a function boot.wim (C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\tbwinre\IFW_BootWIM\boot.wim) If you do not, you need to build one. If it’s in another location edit the Restore-TBI.ps1’s line $builder =
All three files, IFWRestoreReg.reg, Restore-TBI.ps1, and restore-template.ifw, should be stored in C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite by default.
RESTORING USING THIS METHOD DOES NOT ASK FOR A SOURCE, DESTINATION, OR PASSWORD. MAKE SURE THESE VALUES ARE CORRECT IN THE SCRIPTS BEFORE RESTORING.

**Important: this is configured to restore automatically.** The template names a particular target disk and several partitions, and includes `/uy`; TeraByte describes `/uy` as suppressing the overwrite confirmation in an automated restore. A wrong target disk, partition selection, or image can overwrite data. Make a current backup of anything important, and confirm the target and partition choices before using this from the context menu.
This guide assumes you installed Image for Windows in its default location (C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\). If you did not install in that location you’ll need to adjust the below three files accordingly.
###The Three Files
IFWRestoreReg.reg:
---
Code:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SystemFileAssociations\.tbi\shell\RestoreWithIFW]
@="Restore with Image for Windows"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.tbi\shell\RestoreWithIFW\command]
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -NoProfile -ExecutionPolicy Bypass -File \"C:\Program Files (x86)\\TeraByte Drive Image Backup and Restore Suite\\Restore-TBI.ps1\" \"%1\""
---
Restore-TBI.ps1:
---
Code:
param([Parameter(Mandatory = $true)][string]$Image)
$ErrorActionPreference = 'Stop'
$builder = 'C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\tbwinre\TBWinPE.exe'
$templatePath = 'C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\restore-template.ifw'
$runPath = 'N:\restore-selected.ifw'
if (-not (Test-Path -LiteralPath $Image -PathType Leaf)) {
throw "Selected image not found: $Image"
}
$template = [System.IO.File]::ReadAllText($templatePath)
if (-not $template.Contains('__IMAGE__')) {
throw 'The template must contain the placeholder __IMAGE__.'
}
$runFile = $template.Replace('__IMAGE__', $Image)
[System.IO.File]::WriteAllText($runPath, $runFile, [System.Text.Encoding]::Default)
& $builder /bootwim /ifw /run $runPath /quiet
exit $LASTEXITCODE
---
restore-template.ifw:
---
Code:
/r /f:"__IMAGE__" /d:{Value custom to you} /sp:Value(s) custom to you /ohd /trim /rb:4 /opw:Value custom to your .tbi file /uy
-–
### What each file does
**`IFWRestoreReg.reg`** registers the context-menu entry. The menu label is “Restore with Image for Windows,” and the command launches Windows PowerShell with the selected file path (`%1`) as the script’s argument. The registry command points to `C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\Restore-TBI.ps1`, so that script must be at exactly that location—or you must change the registry entry to match where you put it.
**`Restore-TBI.ps1`** receives the selected `.tbi` path as `$Image`. It then:
1. Stops on PowerShell errors.
2. Checks that the selected image exists.
3. Reads `restore-template.ifw`.
4. Requires the template to contain `__IMAGE__`, then substitutes the selected image’s path for that placeholder.
5. Writes the completed run file to `N:\restore-selected.ifw`. This is a temporary run file passed on to TBWinPE.exe that actually restores your .tbi file after reboot and outside of Windows. N:\ is a temp location. If you do not have an N:\ partition within Windows change it to a partition you do have., other than C:\. The script just needs a temporary location to write the restore-selected.ifw file.
6. Starts `TBWinPE.exe` with the run file and exits with the builder’s return code.
The paths are hard-coded. In particular, `N:` must be a usable, writable location for the account running the script, and the template and builder must exist at the specified paths. A mapped drive letter may not be available in an elevated process, so verify that `N:` works in the same context as the context-menu command. Also check whether an existing `restore-selected.ifw` could be overwritten.
**`restore-template.ifw`** is the IFW command file. `/r` requests a restore; `/f:"__IMAGE__"` is the image-file argument, replaced by the selected file path. The `/d:` value and `/sp:` list specify the target and partition-related choices for this restore. Confirm that they identify the intended disk and partitions on *your* machine; don’t assume the GUID or partition numbers are correct just because they appear in the example. The `/d:` value and `/sp:’ values need to be customized for your system. Initiate an IFW restore process without completing it. Select your disk and partitions to restore. During the process, you’ll see the “show command” button. DO NOT CLICK “START.” Click that and you’ll get the values for your specific `/d:` and `/sp:’ values.

Other switches add restore behavior. For example, /rb:4` is a reboot setting; returning to Windows after the restore. `/quiet` is passed to the builder. The `/opw` value in the supplied template stores your hashed password needed for the .tbi file. Only you know that, so edit the /opw: switch to your needs. If there is no password, just delete the switch.
### How to set it up and use it
1. **Check the assumptions first.** Confirm that your IFW installation really has `TBWinPE.exe` at the configured path, that the template and PowerShell script are in the paths named above, and that the destination disk/partition selections match the disk you intend to restore. Confirm that `N:` is available and writable. The example paths are not universal; many installations use different folders. Change if needed.
2. **Review the restore settings before registering the shortcut.** In particular, verify `/d:`, `/sp:`, the image path handling, and any password-related setting.
3. **Save the files in the locations the registry entry expects.** Save the PowerShell script as `C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\Restore-TBI.ps1` and the template as `C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\restore-template.ifw`, or edit the script and registry command to point to your actual locations. Save the `.reg` file as plain text with a `.reg` extension.
4. **Import the registry file.** Merge `IFWRestoreReg.reg` into the registry using an administrator account and accept the confirmation prompts. The `HasLUAShield` entry requests a shield indicator, but don’t treat the icon by itself as proof that the command will run elevated. Test that PowerShell and TBWinPE actually run with the permissions they need before relying on this for a restore.
5. **Test the path without risking a restore.** First verify that right-clicking a `.tbi` file shows the new entry and that the selected image path reaches the script correctly. Before allowing the restore to proceed, inspect the generated `N:\restore-selected.ifw` and confirm that the substituted image path and every target selection are exactly right. Because this command is designed for an automated restore, don’t click it on an image unless you are ready for the specified target to be overwritten.
6. **Run it only when ready.** Right-click the intended `.tbi` file, choose **Restore with Image for Windows**, and allow the machine to restart into the TeraByte recovery environment. Keep the computer powered and don’t interrupt the process. After completion, it may reboot back into Windows according to the `/rb:4` setting.
A `.tbi` file can contain a full partition or disk image; this is not merely a command to browse or extract files. If your goal is to retrieve a few files rather than restore a partition, use IFW’s file-browsing or file-extraction workflow instead.
IMPORTANT NOTES:
Everything between the dashes (-–) is the code for the needed files. Do not include the dashes in the files’ content
/ohd = Assume original harddrive
/trim = Use this option to TRIM the target area of the restore/destination drive prior to restoring the image.
/rb:4 = Reboot without completion message or reboot message, error cancels reboot. (Auto-Reboot upon completion
/opw: = Hashed password, unique to your .tbi file
/uy= tells Image for Windows to assume the answer to all Yes/No prompts is Yes, the answer to all OK/Cancel messages is OK, and the answer to all Abort/Retry/Ignore prompts is Ignore.
This guide assumes you have a function boot.wim (C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite\tbwinre\IFW_BootWIM\boot.wim) If you do not, you need to build one. If it’s in another location edit the Restore-TBI.ps1’s line $builder =
All three files, IFWRestoreReg.reg, Restore-TBI.ps1, and restore-template.ifw, should be stored in C:\Program Files (x86)\TeraByte Drive Image Backup and Restore Suite by default.
RESTORING USING THIS METHOD DOES NOT ASK FOR A SOURCE, DESTINATION, OR PASSWORD. MAKE SURE THESE VALUES ARE CORRECT IN THE SCRIPTS BEFORE RESTORING.
Last edited: