New in version 2.0.
Add, Edit, or Remove Registry Keys and Values using ItemProperties Cmdlets
parameter | required | default | choices | comments |
---|---|---|---|---|
data | no | Registry Value Data. Binary data should be expressed a yaml byte array or as comma separated hex values. An easy way to generate this is to run regedit.exe and use the Export option to save the registry values to a file. In the exported file binary values will look like hex:be,ef,be,ef . The hex: prefix is optional. |
||
datatype | no | string |
| Registry Value Data Type |
key | yes | Name of Registry Key |
||
state | no | present |
| State of Registry Value |
value | yes | Name of Registry Value |
# Creates Registry Key called MyCompany. win_regedit: key: HKCU:\Software\MyCompany # Creates Registry Key called MyCompany, # a value within MyCompany Key called "hello", and # data for the value "hello" containing "world". win_regedit: key: HKCU:\Software\MyCompany value: hello data: world # Creates Registry Key called MyCompany, # a value within MyCompany Key called "hello", and # data for the value "hello" containing "1337" as type "dword". win_regedit: key: HKCU:\Software\MyCompany value: hello data: 1337 datatype: dword # Creates Registry Key called MyCompany, # a value within MyCompany Key called "hello", and # binary data for the value "hello" as type "binary" # data expressed as comma separated list win_regedit: key: HKCU:\Software\MyCompany value: hello data: hex:be,ef,be,ef,be,ef,be,ef,be,ef datatype: binary # Creates Registry Key called MyCompany, # a value within MyCompany Key called "hello", and # binary data for the value "hello" as type "binary" # data expressed as yaml array of bytes win_regedit: key: HKCU:\Software\MyCompany value: hello data: [0xbe,0xef,0xbe,0xef,0xbe,0xef,0xbe,0xef,0xbe,0xef] datatype: binary # Delete Registry Key MyCompany # NOTE: Not specifying a value will delete the root key which means # all values will be deleted win_regedit: key: HKCU:\Software\MyCompany state: absent # Delete Registry Value "hello" from MyCompany Key win_regedit: key: HKCU:\Software\MyCompany value: hello state: absent # Ensure registry paths containing spaces are quoted. # Creates Registry Key called 'My Company'. win_regedit: key: 'HKCU:\Software\My Company'
Common return values are documented here Common Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
data_changed | whether this invocation changed the data in the registry value | success | boolean | False |
data_type_changed | whether this invocation changed the datatype of the registry value | success | boolean | True |
For more information on what this means please read Extras Modules
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.
© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/win_regedit_module.html