K2000 Task - How to Add a DWORD to Existing Registry Key Using .bat/cmd or PowerShell?
I need to add a DWORD to an existing registry key. Locally, if I open CMD or PowerShell and paste the command, it generates a completion successful message. I confirm this by navigating to the specific key.
However, the post task variations I have tried with the same command as a .bat or trying to launch cmd with the command do not seem to be adding the DWORD to the key (however the tasks do not fail). Command is:
reg add HKLM\System\CurrentControlSet\Control\Lsa /v LsaAllowReturningUnencryptedSecrets /t REG_DWORD /d 1 /f
I have tried running .bat starting cmd with the aforementioned command but no joy. It usually just launches cmd.exe and doesn't run the command, or fails with other variations.
Can anyone guide me on how to create a .bat file which launches cmd or PowerShell with the given command, then exits when finished?
I do not want to delete/import the updated key as deleting it lead to boot failure on 2 test machines.
- Using W10 1703 x64
Be the first to answer this question