/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


K2000 Task - How to Add a DWORD to Existing Registry Key Using .bat/cmd or PowerShell?

10/24/2017 1191 views

Hey Guys,

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.

FYI:

- Using W10 1703 x64

Thanks Everyone.

1 Comment   [ + ] Show comment

Comments

  • create .bat with reg import LSA.reg containing your exported reg key (delete all other values if there are more than just that setting in export.reg) zip it and upload to k2000 then set parameter your.bat in postinstall task

Be the first to answer this question

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ