ansible / ansible.builtin / v2.9.24 / module / win_reg_stat Get information about Windows registry keys | "added in version" 2.3 of ansible.builtin" Authors: Jordan Borean (@jborean93) preview | supported by communityansible.builtin.win_reg_stat (v2.9.24) — module
pip
Install with pip install ansible==2.9.24
Like M(win_file), M(win_reg_stat) will return whether the key/property exists.
It also returns the sub keys and properties of the key specified.
If specifying a property name through I(property), it will return the information specific for that property.
- name: Obtain information about a registry key using short form win_reg_stat: path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion register: current_version
- name: Obtain information about a registry key property win_reg_stat: path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion name: CommonFilesDir register: common_files_dir
- name: Obtain the registry key's (Default) property win_reg_stat: path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion name: '' register: current_version_default
name: aliases: - entry - value - property description: - The registry property name to get information for, the return json will not include the sub_keys and properties entries for the I(key) specified. - Set to an empty string to target the registry key's C((Default)) property value. type: str path: aliases: - key description: The full registry key path including the hive to search for. required: true type: str
changed: description: Whether anything was changed. returned: always sample: true type: bool exists: description: States whether the registry key/property exists. returned: success and path/property exists sample: true type: bool properties: description: A dictionary containing all the properties and their values in the registry key. returned: success, path exists and property not specified sample: ? '' : raw_value: '' type: REG_SZ value: '' binary_property: raw_value: - '0x01' - '0x16' type: REG_BINARY value: - 1 - 22 multi_string_property: raw_value: - a - b type: REG_MULTI_SZ value: - a - b type: dict raw_value: description: Returns the raw value of the registry property, REG_EXPAND_SZ has no string expansion, REG_BINARY or REG_NONE is in hex 0x format. REG_NONE, this value is a hex string in the 0x format. returned: success, path/property exists and property specified sample: '%ProgramDir%\\Common Files' type: str sub_keys: description: A list of all the sub keys of the key specified. returned: success, path exists and property not specified sample: - AppHost - Casting - DateTime type: list type: description: The property type. returned: success, path/property exists and property specified sample: REG_EXPAND_SZ type: str value: description: The value of the property. returned: success, path/property exists and property specified sample: C:\\Program Files\\Common Files type: str