Kajoe Posted March 25, 2021 Share Posted March 25, 2021 Dear forum members; I have been trying different ways to get bcdedit /set TESTSIGNING ON and OFF to work in Autoit. I have tried .bat file and .cmd files with admininstrator required acces in Autoit (#RequireAdmin). I have tried following commands in autoit too: Run("bcdedit /set TESTSIGNING ON", "C:\Windows\System32") Run("bcdedit.exe -set TESTSIGNING", "C:\Windows\System32") ShellExecuteWait("TestmodeON.cmd","",@ScriptDir,"",@SW_HIDE) RunWait("TestmodeON.cmd","",@ScriptDir,"",@SW_HIDE) But after restart Testmode is not ON. I also tried to make a SFX of the .bat and .cmd files. But when I run the SFX.EXE file cmd screen goes in endless loops. I found following topic, "How to enable test mode by "run" or "shellexecute"?", but without working advice. Can someone help me with a working command in Autoit? Or is this not possible in Autoit? I have a working cmd attached. When I doubleclick on the CMD, Testmode works after restart of Computer. But the cmd file is not working when I try to use it in Autoit. Thanks in advance. Kajoe TestmodeON.cmd Link to comment Share on other sites More sharing options...
Factfinder Posted March 25, 2021 Share Posted March 25, 2021 (edited) You may try this one: Run(@ComSpec & " /c bcdedit /set {default} testsigning on", "", @SW_HIDE) Edited March 25, 2021 by Factfinder Link to comment Share on other sites More sharing options...
Kajoe Posted March 25, 2021 Author Share Posted March 25, 2021 Hi Factfinder, First of all, thank you very much for quick response. I tried to run it in script, but testmode is not enabled after restart of PC. Link to comment Share on other sites More sharing options...
Factfinder Posted March 25, 2021 Share Posted March 25, 2021 Hi Kajoe, How did you run the script? You should make sure you run the script with administrative privileges. One of the ways is to compile your script, right click and "Run as administrator". Without administrative privileges you don't get access to bcdedit.exe utility. Link to comment Share on other sites More sharing options...
Kajoe Posted March 25, 2021 Author Share Posted March 25, 2021 I did. I have #RequireAdmin on top of my script Link to comment Share on other sites More sharing options...
TheXman Posted March 25, 2021 Share Posted March 25, 2021 (edited) There are a few ways that you can successfully run your bcedit command in AutoIt. I can give you an explanation on why what you've tried so far hasn't worked, if needed. Can you try the following command and see if it works for you? Make sure that you keep the #RequireAdmin directive in the script. ShellExecute("bcdedit.exe", "/set TESTSIGNING ON", "", "runas") Edited March 25, 2021 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Factfinder Posted March 25, 2021 Share Posted March 25, 2021 (edited) Quote I did. I have #RequireAdmin on top of my script I see, you are right. The value is protected. This is the error: An error has occurred setting the element data. The value is protected by Secure Boot policy and cannot be modified or deleted. Edited March 25, 2021 by Factfinder Link to comment Share on other sites More sharing options...
Kajoe Posted March 25, 2021 Author Share Posted March 25, 2021 HiI TheXman, Thank you very much for helping. I tried your command and got following error message. Can't find bcdedit.exe Link to comment Share on other sites More sharing options...
TheXman Posted March 25, 2021 Share Posted March 25, 2021 1 minute ago, Kajoe said: Can't find bcdedit.exe You obviously understand what the error means. Just supply the full path to the the bcdedit utility and rerun it. ShellExecute("c:\windows\system32\bcdedit.exe", "/set TESTSIGNING ON", "", "runas") CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
TheXman Posted March 25, 2021 Share Posted March 25, 2021 it would probably help if you posted the script that you are running too. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Factfinder Posted March 25, 2021 Share Posted March 25, 2021 (edited) 7 minutes ago, Kajoe said: HiI TheXman, Thank you very much for helping. I tried your command and got following error message. Can't find bcdedit.exe How do you compile your script? do you compile to x64 version? Apart from that: Secure Boot is enabled for your computer's UEFI firmware. You need to disable Secure Boot first and then run the commands. Edited March 25, 2021 by Factfinder Link to comment Share on other sites More sharing options...
Kajoe Posted March 25, 2021 Author Share Posted March 25, 2021 same error. Here is my script attached. TestmodeAAN.au3 Link to comment Share on other sites More sharing options...
Kajoe Posted March 25, 2021 Author Share Posted March 25, 2021 Secure Boot is enabled. But why can I run attached batch file and cmd file without problems? And when placed in SFX.EXE or AU3.EXE it is not working. TestmodeON.cmd enable_testmode_v2.0.bat Link to comment Share on other sites More sharing options...
TheXman Posted March 25, 2021 Share Posted March 25, 2021 I find it very odd that you get an error message saying that it cannot find a system utility that is in the C:\Windows\System32 folder. That folder is in the path by default. How are you launching this script and in what type of environment (sccm, AD, psexec, etc)? Since I cannot replicate the "not found" error, there's obviously something very different between your PC's environment and mine. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Kajoe Posted March 25, 2021 Author Share Posted March 25, 2021 wauw Factfinder that did the trick. I had compiled as x86 instead of x64. I have tried it again now. And now it is working perfectly. Thank you very much. I am going to try the other scriptlines above too and will let you know. All thank you very much for super support Link to comment Share on other sites More sharing options...
Factfinder Posted March 25, 2021 Share Posted March 25, 2021 Nice to know. Good luck Kajoe. Link to comment Share on other sites More sharing options...
Kajoe Posted March 25, 2021 Author Share Posted March 25, 2021 All scriptlines above adviced to me, are working perfectly now with x64 compiling. Super. I was trying and searching for days. What a great forum. Thanks mates. You all are super. Link to comment Share on other sites More sharing options...
TheXman Posted March 25, 2021 Share Posted March 25, 2021 👍 Skysnake 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now