Skip to content

onezeroone-dev/OZORegistry-PowerShell-Module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OZORegistry PowerShell Module Installation, Usage, and Guidance

This module provides functions and classes for interacting with the Microsoft Windows Registry.

The Registry

The Registry Editor showing the One Zero One key.

Definitions

Term Definition
Hive The registry is composed of several hives that each contain a hierarchy of keys. The image above shows the HKEY_LOCAL_MACHINE hive.
Key Each hive contains a hierarchy of keys that may contain other keys, and may contain zero or more names. The image above shows the One Zero One key in the SOFTWARE key in the HKEY_LOCAL_MACHINE hive.
Name Each key contains zero or more unique names. The image above shows the (default) and Acronym names in the One Zero One key.
Value Each name may be empty but will usually contain a value. The image above shows that the Acronym name contains the value OZO.
Type Each name has a type. Valid registry types are Binary, Dword, ExpandString, MultiString, Qword, and String. The image above shows the REG_SZ type (String) for the Acronym name.

Types in the Registry vs. PowerShell

Each registry key name has a type. This table details the relationship between registry name types and PowerShell data types to help you align the data you are reading or writing in PowerShell with the corresponding registry data.

Registry Type Registry Display PowerShell Type Description
Binary REG_BINARY Byte[] Byte array
Dword REG_DWORD Int32 32-bit unsigned integer
ExpandString REG_EXPAND_SZ String String that will be expanded when retrieved
MultString REG_MULTI_SZ String[] String array
Qword REG_QWORD Int64 64-bit unsigned integer
String REG_SZ String A regular string

Paths

Registry paths are generally expressed using one of two common formats, e.g., for HKEY_LOCAL_MACHINE:

  • HKEY_LOCAL_MACHINE\SOFTWARE\One Zero One
  • HKLM:\SOFTWARE\One Zero One

Either format is acceptable for all functions in this module.

Installation

This module is published to PowerShell Gallery. Ensure your system is configured for this repository then execute the following in an Administrator PowerShell:

Install-Module OZORegistry

Usage

Importing

Import this module in your script or console to make the functions available for use:

Import-Module OZORegistry

Simple Functions

Advanced Functions

  • Get-OZORegistryKey returns an OZORegistryKey object that represents a registry key (whether existing or not). The resulting object contains methods for reading, adding, updating, and removing key values; and a method for processing (writing) the changes to the registry. This function (and resulting object) is the most robust and flexible use of this module.

Classes

Logging

Messages as written to the Windows Event Viewer One Zero One provider when available. Otherwise, messages are written to the Microsoft-Windows-PowerShell provider under event ID 4100.

License

This module is licensed under the GNU General Public License (GPL) version 2.0.

Acknowledgements

Special thanks to my employer, Sonic Healthcare USA, who supports the growth of my PowerShell skillset and enables me to contribute portions of my work product to the PowerShell community.

About

Microsoft Windows Registry functions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published