Check .NET Framework Version on Windows with Ansible
By Luca Berton · Published 2024-01-01 · Category: installation
Learn how to check the .NET Framework version on Windows systems with Ansible using the win_reg_stat module. Includes a practical Playbook example and execution results.
How to Check the .NET Framework version on Windows-like systems with Ansible? The principle is to read the right Windows Registry key, store in a variable, and display it on the screen. I'm going to show you a live Playbook and some simple Ansible code. I'm Luca Berton and welcome to today's episode of Ansible Pilot
Ansible read Windows Registry • ansible.windows.win_reg_stat • Get information about Windows registry keys
Today we're talking about the Ansible module win_reg_stat. The full name is ansible.windows.win_reg_stat, which means that is part of the collection of modules specialized to interact with Windows target host. It's a module pretty stable and out for years. It works in Windows and Windows Server operating systems. It gets information about Windows registry keys.
Parameters & Return Values
Parameters • path string - The full registry key path including the hive to search for • name string - key path including the hive to search for
Main Return Values • exists, value, raw_value, type, sub_keys
The only mandatory parameter is "path" which is the full registry key path including the hive to search for. You probably would like to specify also the "name" of the key path including the hive to search for. The module returns multiple properties. The most useful are "exists" if the key/property exist in the registry, The value of the key is accessible via the "value" and "raw_value" attributes. Other useful attributes are "type" for the property type and "sub_key" for a list of all the subkeys of the key specified.
Links • ansible.windows.win_reg_stat • How to: Determine which .NET Framework versions are installed
## Playbook
How to check the .NET Framework version on Windows-like systems accessing the Windows Registry with Ansible Playbook. Specifically, the Windows Registry key is "Version" located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full.
code
execution
idempotency
manual check
!win_reg_stat Windows Registry
Conclusion
Now you know how to check the Windows Registry .NET Framework version on Windows-like systems with Ansible.
Related Articles • Ansible Inventory Guide • Ansible for Windows Guide
Category: installation
Watch the video: Check .NET Framework Version on Windows with Ansible — Video Tutorial