Run script with local resources

I’m trying to change a pre-existing registry key on Windows and nothing I have tried is working. First, I tried using the regset/regdelete commands, but nothing happened. The task sequence completed successfully, but the registry key’s value does not change.

regset “[HKLM\SOFTWARE\Application Software\AppName\Subkey]” “File”=string:1234

I even tried with regset64 instead of regular regset. The target OS is Windows 10 x64. No luck. I created a batch file to do this interactively on Windows, which succeeded. I placed the batch file’s syntax into the task inside of a createfile block. Again, task sequence completes successfully, but doesn’t change the key’s value.

delete __createfile
delete regadd.cmd
createfile until EOF

reg delete “HKLM\SOFTWARE\Application Software\AppName\Subkey” /v “File” /f
reg add “HKLM\SOFTWARE\Application Software\AppName\Subkey” /v “File” /t REG_SZ /d “1234” /f

EOF

move __createfile regadd.cmd
wait regadd.cmd

The target registry entry is a REG_SZ despite the numerical values. What am I doing wrong?

Are you on 64 bit? HKLM\Software will be redirected to HKLM\Software\Wow6432Node when using regset. Use regset64 to write to the native 64 bit hive. Also the syntax you have is slightly wrong.

regset "[HKLM\SOFTWARE\Application Software\AppName\Subkey]" "File"="1234"

to write to the 32 bit hive or

regset64 "[HKLM\SOFTWARE\Application Software\AppName\Subkey]" "File"="1234"

for the 64 bit hive

Give this a try…

action uses wow64 redirection false

delete __appendfile
delete regadd.reg

appendfile Windows Registry Editor Version 5.00
appendfile
appendfile [HKEY_LOCAL_MACHINE\Software\Application Software\Subkey]
appendfile “File”=dword:1234

move __appendfile regadd.reg

waithidden regedit /s “regadd.reg”

Yes. I’m on Windows 10 x64, but the registry key needed lives at: HKLM\SOFTWARE\Application Software\AppName\Subkey

Thanks!

What would be the syntax for “File”=string:1234? The registry key is a string.

I had a typo, the native actionscript command for a string value would be

regset64 "[HKEY_LOCAL_MACHINE\SOFTWARE\Application Software\AppName\Subkey]" "File"="1234"

Replace:
appendfile “File”=dword:1234:

With:
“File”=“1234”

Thanks! There must be something else up because it is just not working.