# Obtaining software versions of Windows servers

**URL:** <https://forum.ansible.com/t/obtaining-software-versions-of-windows-servers/36238>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [January 21, 2022, 4:22pm UTC](https://forum.ansible.com/t/obtaining-software-versions-of-windows-servers/36238 "2022-01-21T16:22:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [January 21, 2022, 4:22pm UTC](https://forum.ansible.com/t/obtaining-software-versions-of-windows-servers/36238/1 "2022-01-21T16:22:46Z")

</div>

Occassionally, at my office, we get security alerts for vulnerabilities. I have a playbook that will get run “rpm -q” on the package name and it returns the version installed. For example, google-chrome-stable.

How can I accomplish this on our Windows servers? I have Ansible working for them and have done basic stuff such as win\_ping, win\_command, etc. But I’d like to be able to check the software versions without using RDP to connect to each server and check the version manually.

Thanks for any thoughts,  
Harry

---

<div class="post-metadata">

**Author:** ![Oleg\_Galushko](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@Oleg\_Galushko](https://forum.ansible.com/u/Oleg_Galushko)\
**Post date:** [January 21, 2022, 8:41pm UTC](https://forum.ansible.com/t/obtaining-software-versions-of-windows-servers/36238/2 "2022-01-21T20:41:10Z")

</div>

you need something like this:

- ansible.windows.win\_shell: ‘Get-WmiObject -Class Win32\_Product | Select-Object Name, Version’

пятница, 21 января 2022 г. в 19:22:46 UTC+3, [lift...@gmail.com](mailto:lift...@gmail.com):

---

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [January 21, 2022, 8:51pm UTC](https://forum.ansible.com/t/obtaining-software-versions-of-windows-servers/36238/3 "2022-01-21T20:51:00Z")

</div>

Would I be able to specify a specific program/application, such as Google Chrome for example, using that?

Thanks,  
Harry

---

<div class="post-metadata">

**Author:** ![Oleg\_Galushko](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@Oleg\_Galushko](https://forum.ansible.com/u/Oleg_Galushko)\
**Post date:** [January 21, 2022, 9:03pm UTC](https://forum.ansible.com/t/obtaining-software-versions-of-windows-servers/36238/4 "2022-01-21T21:03:54Z")

</div>

Not all software but most of installed. Just add filter ’ Get-WmiObject -Class Win32\_Product | Where-Object { $\_.Name -like ‘vagrant\*’ } | Select-Object Name, Version’

Chrome is specific, and in this case you can use:

- ansible.windows.win\_shell: ‘[System.Diagnostics.FileVersionInfo]::GetVersionInfo(“C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”).FileVersion’

пятница, 21 января 2022 г. в 23:51:00 UTC+3, [lift...@gmail.com](mailto:lift...@gmail.com):

---

<div class="post-metadata">

**Author:** ![zoredache](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/zoredache/32/1251_2.png) [@zoredache](https://forum.ansible.com/u/zoredache)\
**Post date:** [January 24, 2022, 7:40pm UTC](https://forum.ansible.com/t/obtaining-software-versions-of-windows-servers/36238/5 "2022-01-24T19:40:42Z")

</div>

you need something like this:

- ansible.windows.win\_shell: ‘Get-WmiObject -Class Win32\_Product | Select-Object Name, Version’

Querying Win32\_product isn’t a good idea. It can take a long amount of time because it will result in basically every software package revalidating itself, in some rare cases, it can break things.

- [https://docs.microsoft.com/en-US/troubleshoot/windows-server/admin-development/windows-installer-reconfigured-all-applications](https://docs.microsoft.com/en-US/troubleshoot/windows-server/admin-development/windows-installer-reconfigured-all-applications)
- [https://gregramsey.net/2012/02/20/win32\_product-is-evil/](https://gregramsey.net/2012/02/20/win32_product-is-evil/)

You might want to query the registry instead, which is a more verbose, but has fewer side-effects.
