Adding Multiple Registry Keys

by Jul 2, 2009

With New-Item, it is easy to create new registry keys:

New-Item HKCU:SoftwareTestkey

New-Item can only create one key at a time and fails if the parent key does not exist:

New-Item HKCU:SoftwareTestkeyABCD

However, when you specify the -force switch, New-Item will happily create even multiple keys:

New-Item HKCU:SoftwareTestkeyABCD -force