In the process of creating a series of bootstrap scripts for new machines last year I came across the Win10Debloat package and in the process of reworking it to my needs I created a function to easily apply large numbers of registry tweaks and to make it easier to oranize the sets of registry tweaks.
This function steps through the provided input and makes sure that every part of the path to the desired registry key exists and creates it if it does not. After that it creates and sets the desired value in that registry item.
Here is an example of the structure of the hashtable which the function is expecting to recieve as input:
Now that we have an idea of what the structure should be, lets look at this real set of registry tweaks which I was deploying to prevent Edge from repeatedly stealing the default association with PDF files from Adobe or Foxit.
You can see that each of those paths in this example contain exactly two properties to be modified or created.
These change sets/packages can be fed to the function either as a literal, through the pipeline, or imported from a file and ingested.