RunMe_About PreparationForDellBiosWUTTest

:: *****************************************************************************************************************************************************************
:: 20240613
:: 该脚本可以用作BIOS WU测试前的准备工作,包括:自动检测"C:\DellBiosWUT\"路径是否存在;"Capsule files"的创建;"Certificate"的安装;"BIOS recovery file"的自动删除;"test signing"状态的开启.
:: 注意: 因有些文件权限问题,最好使用超级管理员CMD窗口运行该脚本;如果运行过程中遇到问题,可以通过重启系统或删除所有生成的文件后再次运行该脚本.
:: 作者: Darren Zhang
:: *****************************************************************************************************************************************************************


@echo off

echo.
echo ************************************** Check whether the "C:\DellBiosWUT\" path exists **************************************
echo.
IF EXIST C:\DellBiosWUT\ (echo The "C:\DellBiosWUT\" path exists ! && echo. && start C:\DellBiosWUT && goto CFC) ELSE (echo The "C:\DellBiosWUT\" path does not exist ! && echo. && goto ACDFST)

:ACDFST
echo.
echo **************************** Automatically copies 'DellBiosWUT' from server to 'C:\DellBiosWUT\' ****************************
echo.
:: echo Copy 'DellBiosWUT' folder from server "\\172.17.1.222\Test Tools\BIOS\Common Tool\" to 'C:\DellBiosWUT\' and open it.
rem xcopy /E /Y "\\172.17.1.222\Test Tools\BIOS\Common Tool\DellBiosWUT" C:\DellBiosWUT\ >nul
xcopy /E /Y "\\172.17.1.222\Test Tools\BIOS\Common Tool\DellBiosWUT" C:\DellBiosWUT\
start C:\DellBiosWUT
echo.

:CFC
echo *********************************************** Capsule files creation *******************************************************
echo.
echo [* Now pls manually copy the latest/current BIOSCapsule/WU files- firmware.bin and firmware.inf to C:\DellBiosWUT. *]
Choice /M "Whether to complete file replication: "
if %ERRORLEVEL%==1 (goto CWAFE) else (goto CFC)
echo.

:CWAFE
echo.
echo [*] Check whether all files exist [*] 

IF EXIST C:\DellBiosWUT\firmware.bin (
    IF EXIST C:\DellBiosWUT\firmware.inf (
        goto RTBCFC
    ) ELSE (
        echo The firmware.inf file does not exist ! && echo. && goto CFC
    )
)
IF EXIST C:\DellBiosWUT\firmware.inf (
    IF EXIST C:\DellBiosWUT\firmware.bin (
        goto RTBCFC
    ) ELSE (
        echo The firmware.bin file does not exist ! && echo. && goto CFC
    )
)
IF NOT EXIST C:\DellBiosWUT\firmware.inf (
    IF NOT EXIST C:\DellBiosWUT\firmware.bin (
        echo firmware.bin/firmware.inf neither file exist ! && echo. && goto CFC
    )
)
 
:RTBCFC
echo firmware.bin/firmware.inf both files exist !    
echo.
:: echo Ready to begin capsule files creation
echo.
echo [* Pls enter your desired capsule files name.(EG.D13CSB1150) *]
set /p CapsuleName=

echo.
echo [*] Start creating capsule files ... [*] 
:: Open another cmd window and enter the relevant instructions (Create a "ForDellBiosWUTest" folder in "C:\DellBiosWUT\", also unzip the generated Capsule .exe file to "ForDellBiosWUTest" folder ), then close the cmd windows.
rem start /WAIT cmd.exe /k "cd C:\DellBiosWUT && createwupkgNew.bat %CapsuleName%.exe && echo Pls select or create a folder to extract the generated files ! && %CapsuleName%.exe && exit"
start /WAIT cmd.exe /k "cd C:\DellBiosWUT && createwupkgNew.bat %CapsuleName%.exe && IF EXIST C:\DellBiosWUT\ForDellBiosWUTest (rd /s /q "C:\DellBiosWUT\ForDellBiosWUTest") ELSE (mkdir "ForDellBiosWUTest") && echo Pls select the 'C:\DellBiosWUT\ForDellBiosWUTest\' folder to extract the generated files ! && %CapsuleName%.exe && exit"
echo Complete the generation of capsule files !
echo.

echo *********************************************** Certificate install *******************************************************
echo.
echo Notes: Pls select the "Local Machine" and select "Next". Select the "Place all certificates in the following store".Select "Browse" then locate/select the "Trusted Root Certification Authorities" and select "Ok".Select "Next". Select "Finish" and confirm with "Yes".
start /WAIT cmd.exe /k "cd C:\DellBiosWUT\ForDellBiosWUTest && fwu.cer && exit"
start C:\DellBiosWUT\ForDellBiosWUTest
echo.
echo Complete the certificate install !
echo.

echo ****************************************** BIOS Recovery files from HDD cleared ********************************************
echo.
start cmd.exe /k "mountvol h: /s && H: && cd H:\EFI\Dell\bios\recovery && del /s H:\EFI\Dell\bios\recovery\* && start H:\EFI\Dell\bios\recovery && exit"
ping 127.0.0.1 -n 12 >nul

echo BIOS Recovery files from HDD cleared success!
echo.

echo *********************************************** Enable test signing *******************************************************
echo.
echo [*] Disable driver enforcement and disabled driver signing ... [*] 
bcdedit -set loadoptions DDISABLE_INTEGRITY_CHECKS
bcdedit -set TESTSIGNING ON

echo.
echo Disable driver enforcement and disabled driver signing success!
echo.

start cmd.exe /k "mode con cols=112 lines=20 && COLOR 0C && title WARM PROMPT && echo IMPORTANT NOTE: && echo Please remember to manually disable test signing through below command after the test !!!!!! && echo "bcdedit -set loadoptions ENABLE_INTEGRITY_CHECKS ; bcdedit -set TESTSIGNING OFF" "

echo *************************************** SUT will restart automatically after 12 seconds !!! ********************************
shutdown /r /t 12
pause

:END
exit


 

  • 24
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值