API Reference
RegistryWriter
Helpers for writing Windows Registry values (local or remote). Supports typed writers and alias expansion with WhatIf planning. Handles HKLM (local or remote), HKCU/HKU on the local machine, and mounted offline hives.
Inheritance
- Object
- RegistryWriter
Methods
public static Boolean CreateKey(String computer, String fullPath) #BooleanCreates a registry key at the specified absolute path on a local or remote machine.
Parameters
- computer System.String
- fullPath System.String
public static Boolean DeleteKey(String computer, String fullPath, Boolean recursive = false) #BooleanDeletes a registry key at the specified absolute path (optionally recursive).
Parameters
- computer System.String
- fullPath System.String
- recursive System.Boolean = false
public static Boolean DeleteValue(String computer, String path, String name) #BooleanDeletes a registry value under the specified key.
Parameters
- computer System.String
- path System.String
- name System.String
public static Boolean WriteBinary(String computer, String path, String name, Byte[] value) #BooleanWrites a REG_BINARY value.
Parameters
- computer System.String
- path System.String
- name System.String
- value System.Byte[]
public static Boolean WriteDword(String computer, String path, String name, Int32 value) #BooleanWrites a REG_DWORD value.
Parameters
- computer System.String
- path System.String
- name System.String
- value System.Int32
public static IEnumerable<WritePlan> WriteExpanded(String computer, String path, String name, Object value, RegistryValueKind kind, Boolean whatIf = false) #IEnumerable<WritePlan>Writes to a path that may contain alias roots (HKUA/HKUD/HKUO/HKUAD/HKUDU/HKUDUD/HKUDUO/HKUDUDO). Expands into concrete HKU paths; mounts/unmounts offline hives automatically. When whatIf=true, returns a plan without performing writes.
Parameters
- computer System.String
- path System.String
- name System.String
- value System.Object
- kind Microsoft.Win32.RegistryValueKind
- whatIf System.Boolean = false
public static Boolean WriteMultiString(String computer, String path, String name, String[] value) #BooleanWrites a REG_MULTI_SZ value.
Parameters
- computer System.String
- path System.String
- name System.String
- value System.String[]
public static Boolean WriteQword(String computer, String path, String name, Int64 value) #BooleanWrites a REG_QWORD value.
Parameters
- computer System.String
- path System.String
- name System.String
- value System.Int64
public static Boolean WriteString(String computer, String path, String name, String value, Boolean expand = false) #BooleanWrites a REG_SZ or REG_EXPAND_SZ value.
Parameters
- computer System.String
- path System.String
- name System.String
- value System.String
- expand System.Boolean = false
public static Boolean WriteValue(String computer, String path, String name, Object value, RegistryValueKind kind, Boolean adjustAcl = false) #BooleanWrites a registry value to HKLM/HKU/HKCU (local) or HKLM/HKU (remote/mounted) with an explicit kind.
Parameters
- computer System.String
- Target host name or '.'.
- path System.String
- Absolute path such as HKLM\Software\.. or HKU\SID\..
- name System.String
- Value name (use empty for (Default)).
- value System.Object
- Value to write.
- kind Microsoft.Win32.RegistryValueKind
- Registry value kind.
- adjustAcl System.Boolean = false
- When true, retries HKLM writes with a temporary Administrators RW ACE on access denied.
Returns
True when the write succeeded.
public static Task<Boolean> WriteValueAsync(String computer, String path, String name, Object value, RegistryValueKind kind, CancellationToken ct = null) #Task<Boolean>Async convenience wrapper for Boolean); runs on the thread pool and supports cancellation.
Parameters
- computer System.String
- path System.String
- name System.String
- value System.Object
- kind Microsoft.Win32.RegistryValueKind
- ct System.Threading.CancellationToken = null
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object