Kaseya Community

Copy/replicate registry value to another key.

  • Is it possible to copy a registry value from one key to another through procedure? Or export then import into the second? I have a RemoteApp program that requires explicit permissions. My goal is to publish a second application through set64BitRegistryValue (which works fine, minus permissions) and somehow replicate the "SecurityDescriptor" value into this second application, which holds the client group information.

    So far I have:

    If get64RegistryValue [path to current SecurityDescriptor] exists

    I just don't know where to go from there.

    Any assistance would be greatly appreciated.

  • Use the getVariable command to read the registry and save the result to a variable. Then you can use the setRegistryValue commands to write the variable contents to the new location.

    Here's some example code to get you started:

    Procedure Name: Example Reg Copy
    Procedure Type: Agent
    ================================================================================
      1 | // Set the 64 and 32 bit reg paths
      2 | getVariable("ConstantValue", "HKLM\64\someplace", "HK64bit", "All Windows Operating Systems", "Halt on Fail")
      3 | getVariable("ConstantValue", "HKLM\32\someplace", "HK32bit", "All Windows Operating Systems", "Halt on Fail")
      4 | If get64BitRegistryValue("#HK64bit#") Exists
      5 |     // See of the key exists - if so, read the data and write it elsewhere
      6 |     getVariable("RegistryValue", "#HK64bit#", "RegData", "All Windows Operating Systems", "Halt on Fail")
      7 |     setRegistryValue("#HK32bit#, "#RegData#", "REG_SZ", "All Windows Operating Systems", "Halt on Fail")
      8 |     WriteProcedureLogEntry("Updated the registry", "All Windows Operating Systems", "Halt on Fail")
      9 | Else
      10 |     // Report it didn't exist
      11 |     WriteProcedureLogEntry("Registry key not found - not updated!", "All Windows Operating Systems", "Halt on Fail")

    Glenn

  • I only needed one get and one set but this works beautifully! Thank you so much Glenn!