$cs.Reg_CreateKey
Description
Section titled “Description”Creates a registry key at the given path, automatically creating any missing parent keys along the way. If the key already exists, nothing happens.
Syntax
Section titled “Syntax”$cs.Reg_CreateKey(string regroot, string regpath)
Parameters
Section titled “Parameters”regroot (String)
Section titled “regroot (String)”Root hive: HKLM/HKEY_LOCAL_MACHINE, HKCU/HKEY_CURRENT_USER, or HKU/HKEY_USERS.
regpath (String)
Section titled “regpath (String)”Registry key path to create, relative to regroot. Missing parent keys are created automatically.
Return value
Section titled “Return value”None.
Example
Section titled “Example”$cs.Reg_CreateKey('HKLM', 'SOFTWARE\7-Zip')Creating a nested vendor/product key structure to hold app-specific configuration, even though none of the parent keys exist yet.
$cs.Reg_CreateKey('HKLM', 'SOFTWARE\Contoso\AppSuite\Licensing')$cs.Job_WriteLog("Created Licensing configuration key")Creating a per-feature subkey during PostInstall so later steps can write feature-specific settings into it.
$cs.Reg_CreateKey('HKLM', 'SOFTWARE\Contoso\AppSuite\Features\Reporting')$cs.Reg_SetDword('HKLM', 'SOFTWARE\Contoso\AppSuite\Features\Reporting', 'Enabled', 1)