Sleep
3 min readJul 5, 2023

Lenovo Auto Recovery Batch Script

How to Enable Recovery in Your Lenovo BIOS Using a Batch Script
Have you ever encountered issues with your Lenovo computer and wished you had a way to recover it easily? If so, you might be interested in learning how to enable recovery in your computer’s BIOS.

Fortunately, there is a batch script that can help you do just that. In this article, we will explain how the script works and how you can use it to enable recovery in your Lenovo BIOS.

Starting the Auto-Recovery Process

The first thing the script does is display a message to indicate that it is starting the auto-recovery process. Then, it waits for 30 seconds to give you time to cancel the process if you need to.

Checking if Recovery is Enabled in the BIOS

Next, the script uses the Windows Management Instrumentation Command-line (WMIC) tool to check if recovery is enabled in the BIOS. If it is not enabled, the script prompts you to enable it and restart the computer.

The script uses the following WMIC commands to enable recovery in the BIOS:

wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "SecurityChip,Active"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "BiosPassword,1qazxsw2"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "BootOrderLock,Enabled"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "IntelTXT,Enabled"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "TPMControl,Enabled"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "TPMActivation,Enabled"

These commands enable various security features in the BIOS, including the Security Chip, BIOS Password, Boot Order Lock, Intel TXT, TPM Control, and TPM Activation.

Rebooting the Computer

Finally, the script uses the shutdown command to reboot the computer and apply the changes. Once the computer reboots, recovery will be enabled in the BIOS.

Conclusion

Enabling recovery in your Lenovo BIOS is important if you want to be able to recover your computer easily in case of issues. With the batch script we have provided, you can easily enable recovery in your BIOS without having to navigate through the BIOS settings yourself.

Just remember that enabling recovery in the BIOS involves making changes to the security settings of your computer, so make sure you understand the implications of these changes before you proceed.

The following Script is the full script to automate and use this fuction.

@echo off
echo Starting the auto-recovery process...

:: Wait for 30 seconds to give the user time to cancel the recovery process
timeout /t 30 /nobreak >nul

:: Check if recovery is enabled in the BIOS
:: If not, prompt the user to enable it and restart the computer
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "SecurityChip,Active"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "BiosPassword,1qazxsw2"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "BootOrderLock,Enabled"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "IntelTXT,Enabled"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "TPMControl,Enabled"
wmic /namespace:\\root\wmi PATH Lenovo_SetBiosSetting CALL SetBiosSetting "TPMActivation,Enabled"

:: Reboot the computer to apply the changes
shutdown /r /t 0
::This code checks if recovery is enabled in the BIOS and prompts the user to enable it and restart the computer if it is not enabled. The timeout command at the beginning of the script gives the user time to cancel the recovery process if needed.
echo Auto-recovery process completed. Please check your system for any issues.

No responses yet