Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Ensure Registry Key

Modified on July 26, 2024

Ensures that a registry key exists or does not exist.

Script usage:

Windows::Ensure-RegistryKey(
	[Exists: <true/false>],
	[DefaultValue: <text>],
	Hive: <integer>,
	Key: <text>
);

Arguments:

NameFormatScript UsageUsage Notes
Exists
true/false
Exists
Default value is "True".
Default value
text
DefaultValue
A key's default value is the legacy unnamed value that every registry key may have. This is rarely used.
Hive
integer
Hive
This argument is required.
Key
text
Key
This argument is required.

Example:

Windows::Ensure-RegistryKey
(
    Hive: LocalMachine,
    Key: SOFTWARE\Inedo\BuildMaster
);