Join AnsibleFest at Red Hat Summit!

community.windows.win_file_version module – Get DLL or EXE file build version

Note

This module is part of the community.windows collection (version 2.4.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.windows.

To use it in a playbook, specify: community.windows.win_file_version.

Synopsis

  • Get DLL or EXE file build version.

Parameters

Parameter

Comments

path

path / required

File to get version.

Always provide absolute path.

Notes

Note

  • This module will always return no change.

See Also

See also

ansible.windows.win_file

Creates, touches or removes files or directories.

Examples

- name: Get acm instance version
  community.windows.win_file_version:
    path: C:\Windows\System32\cmd.exe
  register: exe_file_version

- debug:
    msg: '{{ exe_file_version.win_file_version }}'

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

win_file_version

complex

dictionary containing all the version data

Returned: success

file_build_part

string

build number of the file.

Returned: no error

Sample: "2"

file_major_part

string

the major part of the version number.

Returned: no error

Sample: "0"

file_minor_part

string

the minor part of the version number of the file.

Returned: no error

Sample: "30"

file_private_part

string

file private part number.

Returned: no error

Sample: "0"

file_version

string

File version number.

Returned: no error

Sample: "v0.30.2"

file_version_raw

string

added in community.windows 2.4.0

File version number that may not match the file_version

Returned: no error

Sample: "0.30.2.0"

path

string

file path

Returned: always

product_version

string

The version of the product this file is distributed with.

Returned: no error

Sample: "0.30.2+b4a594409fc9e79e7c5161763cf1c4328e9c5a5d"

Authors

  • Sam Liu (@SamLiu79)

  • Mikhail Samodurov (@EasyMoney322)