Search notes:

Windows registry structure: value

Writing a value to the registry with reg in a console

In a console (cmd.exe or PowerShell), a value can be written to the registry with reg add /v ….
In PowerShell, a value can be created or modified with set-itemProperty.

PowerShell's representation of a registry value

In PowerShell, a registry value is represented by an itemProperty.

Querying a key

An existing value, for example the value of PATH in the registry key HKCU:\Environment, can be queried like so:
PS C:\> get-itemProperty HKCU:\Environment PATH
Unfortunately, this also prints varios PS* members like PSPath etc:
Path         : C:\Users\Rene\bin/scripts;…
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Environment
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER
PSChildName  : Environment
PSDrive      : HKCU
PSProvider   : Microsoft.PowerShell.Core\Registry
Therefore, get-itemPropertyValue seems to be the better approach:
PS C:\> get-itemPropertyValue HKCU:\Environment PATH

Creating a new value

Similarly, aew registry value can be created with new-itemProperty cmdLet:
PS C:\> $null = new-itemProperty HKCU:\Environment keyName -value 42

Dropping the value again

In PowerShell, a value can be deleted from a registry key with remove-itemProperty.
PS C:\> remove-itemProperty HKCU:\Environment keyName

See also

default value
Windows registry: tree structure

Index