Skip to main content

1E 23.11 (SaaS)

NativeServices.RegistrySetUserValues

Method

RegistrySetUserValues

Module

NativeServices

Library

Core

Action

Sets a registry value for every user under HKU. This will create the value and any key hierarchy required.

Parameters

Subkey (string): The registry key to look for.

Name (string): The name of the registry value to set.

Value (string): The value that will be set.

ValueType (string): One of these supported types: "REG_SZ", "REG_EXPAND_SZ", "REG_BINARY", "REG_DWORD", "REG_QWORD", "REG_MULTI_SZ".

UsersOnly (bool, optional, default false): Set values only for keys representing "real" users (and not for keys representing system pseudo-users such as Local System nor groups).

Return values

Status (string): The status of the key; "Set value" or "Created key and set value" as appropriate.

Sid (string): SID the value was found under.

Username (string): Domain\Username of the aforementioned SID.

Example

NativeServices.RegistrySetUserValues(Subkey:"test\\test2", Name:"temporaryStringValue", Value:"no need for concern", ValueType:"REG_SZ");

Platforms

  • Windows

Notes

Unlike most registry methods, the 8192 limit is not imposed because doing so would leave the system in an inconsistent state (some users would have the value, others not), and in practice it is highly unlikely that any system would have that many users.

A REG_BINARY Value is a string of hex digits, e.g. "546F6D". Upper, lower or mixed case can be used.

If information is retrieved from the .DEFAULT key or a _Classes key, the Username will be reported as "Unknown". It is possible to determine the owner of a _Classes key from the SID that precedes it (which will have a correct Username).

Warning

This method may attempt to call AD to translate a SID to a username.