A data structure organizes external data so reusable PowerShell functions can process it without repeating registry-checking code. For security baselines, it prevents separate, growing scripts for operating-system versions and server roles. section 6.2
Design the structure from the conditions the automation must evaluate:
- Represent each registry check with a key path, key name, expected value, and evaluation rule. section 6.2.1
- Map equality and greater-than-or-equal conditions to PowerShell comparison operators such as -eq and -ge. section 6.2.1
- Represent a range with an array and -in, and represent alternatives with nested operator-and-value tests. section 6.2.1
- Use a class when the structure must preserve integrity, then store related data externally in human-readable serialized files. section 6.2 section 6.4
Registry check with alternative tests
@{ KeyPath = 'HKLM:\SYSTEM\Path\Example' Name = 'SecurityKey' Tests = @( @{ operator = 'eq'; value = '1' } @{ operator = 'eq'; value = $null } ) } section 6.2.1
Table 6.1 Registry key values to check (view table figure)
| All key paths start in HKLM:\SYSTEM\CurrentControlSet\Services\ |
||
Use the registry-value table to compare key paths, names, expected values, and conditions before designing the data representation. section 6.2.1









