I'm currently trying to add a registry key to mutiple registry folders. However becasue you can't wildcard registry keys via group policy I'm using a ps1 script to add these keys. Essentially I would like to add a REG_Binary key with the hex value of 00 00 00 00 in this location: HKCU:\SOFTWARE\Microsoft\Office\15.0\Outlook\Profiles\name of outlook profile\c02ebc5353d9cd11975200aa004ae40e.
I have the code that adds this key on one profile using one line of PS. This is:
$path = "HKCU:\SOFTWARE\Microsoft\Office\15.0\Outlook\Profiles\Name of Outlook Profile\c02ebc5353d9cd11975200aa004ae40e"
New-ItemProperty -Path $path -Name 00030354 -PropertyType Binary -Value ([byte[]](0x00,0x00,0x00,0x00)) -Force
This works perfectly, however I need to do this on all folders in the profiles directory. I can find out all the profile names in this string via this command:
$Profilelist = get-childItem "HKCU:\Software\Microsoft\Office\15.0\Outlook\Profiles\*" | select name
How can I add the value "\c02ebc5353d9cd11975200aa004ae40e" to each line of this array/list?
After adding this I will be able to use a for each command to add the key.
If anyone knows a better way I'm open to other ideas!
Thanks in advance! :)