Kaseya Community

executeShellCommand issue

  • I tested and ran the two commands on the local machine to append registry editor and they both worked. 

    The command lines were: 

    REG ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319" /v SchUseStrongCrypto /t REG_DWORD /d 1 /f

    REG ADD "HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" /v SchUseStrongCrypto /t REG_DWORD /d 1 /f

    So then I created the agent procedure and it looks like this:

    executeShellCommand("REG ADD "HKLM\SYSTEM\Wow6432Node\Microsoft\.NETFramework\v4.0.30319 /v SchUseStrongCrypto /t REG_DWORD /d 1 /f", "Execute as System", "All Operating Systems", "Hail on Fail")

    executeShellCommand("REG ADD "HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SchUseStrongCrypto /t REG_DWORD /d 1 /f", "Execute as System", "All Operating Systems", "Hail on Fail")

    The First execute command succeed but the Second execute command did not. So I ran the Second execute command alone and it did not work. Then I ran the First execute command alone and it worked. 

    Is there a reason for the Second execute command not working? I even disabled the Anti-Virus and it still did not work. 

    Any help is greatly appreciated!! 

  • for the second command, try "Execute as System in 64 bit shell"

  • Also of note is that there is a function within the Kaseya Agent Procedure Editor to allow you to Set Registry Values directly, rather than running a command shell to call registry commands:

    • setRegistryValue() / set64BitRegistryValue()

    See:  help.kaseya.com/.../9050000

  • Some registries on a 64bit system work via the 32bit registry commands, and others will fail as they need to run as 64bit.

    Its easy enough to resolve once you know a 32bit registry command isnt working.

  • The first command probably succeeds in 32bit shell on a 64bit system as it explicitly targets wow6432Node.

    The first command would fail on 32bit system as the key only exists on 64bit machines.

    The second command would succeed in native shell on a 32bit system as the key exists.

    The second command would fail on a 32bit shell on a 64bit machine as Reg.exe tries to be aware of 64bit paths and change its context to be 64bit, but this doesn't work from Kaseya, so you need to explicitly tell it to run the command in a 64bit shell, or use the set64BitRegistryValue() command.