Skip to content

Add Registry Key

Raymond Piller edited this page Apr 20, 2018 · 1 revision

You can also remove a registry key ...

Add a registry key with RegistryPlus:

RegistryPlus Add_Key
{
    Ensure = 'Present'
    Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Test'
}

This is doable, with Registry. However, I believe it feels a bit clunky and have asked for the rogue ValueName to be removed. Here's how you would do it with Registry:

Registry Add_Key
{
    Ensure = 'Present'
    Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Test'
    ValueName = ''
}

With RegistryPlus, we just build the above Registry configuration for you before compiling the MOF. Keeping your files cleaner, and requiring no additional modules be installed on each of your clients.

Notes

  • I don't see much of a use case for this functionality, but since I was adding the ability to remove a registry key, it was trivial to add this functionality as well.
  • You do not need to add a registry key before adding values under with Registry.

Clone this wiki locally