I'm using Puppet 4.2, and I have got a job where I need to change some values from the registry using the Puppet Registry Module
I'm trying to change a registry value in the hive HKEY_USERS
, but I saw that the Puppet module doesn't work over there.
I tried a different approach: changing this value with Powershell, but it does not work with the
Puppet Powershell Module
This is the code that I run:
'$null=New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS -ErrorAction SilentlyContinue; Set-ItemProperty -Path $("HKU:\"+$((Get-WmiObject Win32_useraccount) | ?{$_.Name -eq "Administrator"}).SID+"\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize") -Name EnableTransparency -Value 0 -Force'
If I run it with puppet it doesn't work, and when I run it in the local console it does.
HKEY_USERS is now supported in the unreleased version of puppetlabs/registry (unreleased as of November 2016). I would look for that to become available in a 1.1.4 release of the module on the forge. Until then you can use the GitHub master branch - https://github.com/puppetlabs/puppetlabs-registry.
For more information, see https://tickets.puppetlabs.com/browse/MODULES-3865. For managing HKCU, see https://tickets.puppetlabs.com/browse/MODULES-422.