$cs.Reg_SetString
Description
Section titled “Description”Writes a REG_SZ (string) registry value. The key is created automatically if it doesn’t exist yet.
Syntax
Section titled “Syntax”$cs.Reg_SetString(string registryroot, string regkey, string regvaluename, string regvaluedata)
Parameters
Section titled “Parameters”registryroot (String)
Section titled “registryroot (String)”Root hive: HKLM/HKEY_LOCAL_MACHINE, HKCU/HKEY_CURRENT_USER, or HKU/HKEY_USERS.
regkey (String)
Section titled “regkey (String)”Registry key path, relative to registryroot. Created automatically if it doesn’t exist.
regvaluename (String)
Section titled “regvaluename (String)”Name of the value to write.
regvaluedata (String)
Section titled “regvaluedata (String)”String to write.
Return value
Section titled “Return value”None.
Example
Section titled “Example”$cs.Reg_SetString('HKLM', 'SOFTWARE\Contoso\AppSuite', 'InstallPath', $global:Packageroot)Writing a couple of related configuration values under the application’s own settings key:
$cs.Reg_SetString('HKLM', 'SOFTWARE\Contoso\AppSuite', 'ConfigServer', 'https://config.contoso.example')$cs.Reg_SetString('HKLM', 'SOFTWARE\Contoso\AppSuite', 'Environment', 'Production')Writing a custom app-tracking marker so PowerPacks can later confirm this exact package version was applied.
$cs.Reg_SetString('HKLM', 'SOFTWARE\Contoso\AppSuite', 'InstalledByPackage', 'AppSuite-4.8.1')$cs.Job_WriteLog("Recorded package tracking marker")Related functions
Section titled “Related functions”$cs.Reg_GetString $cs.Reg_SetExpandString $cs.Reg_DeleteVariable