Hash Tables
Cheat sheet · https://pcornel.dk/topic.php?topic=3044
Answer
A PowerShell hash table maps keys to values and is commonly used for configuration data, lookups, calculated structures and parameter splatting. It is not the same as a PSCustomObject even though both can present name/value-like data.
Remember
- Hash table keys identify values; iteration order should only be relied on when using an ordered dictionary where order is part of the requirement.
- Splatting passes entries as parameters but does not validate that those keys match the chosen command/parameter set until binding.
- A hashtable and a PSCustomObject have different access/member semantics.
- Key comparison/casing behavior follows the dictionary implementation and PowerShell conventions.
- Nested hash tables are common for configuration but need schema/validation to avoid silent misspellings.
First checks
$PSVersionTable— PowerShell edition and versionGet-Command <name>— which cmdlet/function/exe runsGet-Help <cmdlet> -Full— syntax and parametersGet-ExecutionPolicy -List— execution policy per scope
Verify in this order
key/value pairs → looked up by key → used for data or parameter splatting
Where it usually breaks
First mismatch in definition/configuration → security context → service/task/process creation → runtime state → output/side effect → event/performance evidence; preserve identity/native error/pre-state before mutation.
PowerShell → Hash Tables reference map
| Item | Meaning | Evidence boundary |
|---|---|---|
| Hashtable | Key/value map | content may be incomplete/unvalidated |
| Ordered dictionary | Preserved insertion order | order does not imply command semantics |
| Splatting | Parameter expansion | binding still occurs at invocation |
| PSCustomObject | Property-oriented object | not identical dictionary semantics |
| Nested config | Structured settings | needs schema/required-key validation |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3044