# \[Urgent help\] Ansible for fetching and comparing windows OS configuration, performance stats

**URL:** <https://forum.ansible.com/t/urgent-help-ansible-for-fetching-and-comparing-windows-os-configuration-performance-stats/26939>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [March 9, 2018, 4:35am UTC](https://forum.ansible.com/t/urgent-help-ansible-for-fetching-and-comparing-windows-os-configuration-performance-stats/26939 "2018-03-09T04:35:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akash\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@Akash\_Agarwal](https://forum.ansible.com/u/Akash_Agarwal)\
**Post date:** [March 9, 2018, 4:35am UTC](https://forum.ansible.com/t/urgent-help-ansible-for-fetching-and-comparing-windows-os-configuration-performance-stats/26939/1 "2018-03-09T04:35:42Z")

</div>

Hi All,

Is there a way to use Ansible to fetch Windows OS specific configuration using Ansible on demand ?  
Is there a way to fetch OS updates, Open Ports, Windows Running Services list?  
Is there a way to monitor Windows Performance Counters for a duration of time ?

Thanks,  
Akash

---

<div class="post-metadata">

**Author:** ![Akash\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@Akash\_Agarwal](https://forum.ansible.com/u/Akash_Agarwal)\
**Post date:** [March 12, 2018, 9:03am UTC](https://forum.ansible.com/t/urgent-help-ansible-for-fetching-and-comparing-windows-os-configuration-performance-stats/26939/2 "2018-03-12T09:03:40Z")

</div>

Any answers to this would help a lot

---

<div class="post-metadata">

**Author:** ![SUMIT\_SAHAY](https://avatars.discourse-cdn.com/v4/letter/s/97f17d/32.png) [@SUMIT\_SAHAY](https://forum.ansible.com/u/SUMIT_SAHAY)\
**Post date:** [March 14, 2018, 10:26am UTC](https://forum.ansible.com/t/urgent-help-ansible-for-fetching-and-comparing-windows-os-configuration-performance-stats/26939/3 "2018-03-14T10:26:19Z")

</div>

Hi Akash,  
For your second question I guess ansible having modules for updates and all, please check this

[http://docs.ansible.com/ansible/latest/win\_updates\_module.html](http://docs.ansible.com/ansible/latest/win_updates_module.html)

For checking open port, there are couple of powershell script if you trigger that powershell script through ansible your will get output  
For triggering the powershell script you can use win\_shell module in ansible it will run on window server and perform the output you can write the output in some file and for audit purpose.

Thanks & Regards  
Sumit Sahay

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 16, 2018, 9:39am UTC](https://forum.ansible.com/t/urgent-help-ansible-for-fetching-and-comparing-windows-os-configuration-performance-stats/26939/4 "2018-03-16T09:39:55Z")

</div>

Hi, some suggestions below…

> Hi All,
> 
> Is there a way to use Ansible to fetch Windows OS specific configuration using Ansible on demand ?

run or re-run the ansible `setup` module, which will gather lots of facts about your windows hosts.

> Is there a way to fetch OS updates, Open Ports, Windows Running Services list?

win\_updates module for OS updates.

You can use win\_command or win\_shell modules to run powershell to get a lot of this kind of information

get active network connections like this  
ansible windows\_hosts -m win\_command -a ‘netstat -ano’

get running processes (visible to user you have connected as like this)

ansible windows\_hosts -m win\_shell -a “Get-Process”

get installed hotfixes like this:

ansible windows\_hosts -m win\_shell -a “Get-Hotfix”

> Is there a way to monitor Windows Performance Counters for a duration of time ?

Not tried, but you could probably make use of these powershell functions to export performance data to graphite [https://github.com/MattHodge/Graphite-PowerShell-Functions/tree/v1.1.0](https://github.com/MattHodge/Graphite-PowerShell-Functions/tree/v1.1.0) - described here [https://hodgkins.io/using-powershell-to-send-metrics-graphite](https://hodgkins.io/using-powershell-to-send-metrics-graphite)

I’d recommend having a look at what you can do using powershell, at lot of useful administrative information is available via powershell, and its relatively easy to get at it using powershell.

If you need to process the raw results within ansible I’d recomend having a look at creating your own modules - once you have the powershell command to get the right information, its not much more work to turn it into an ansible module - you only really need to handle any module parameters and build up the information that it makes sense to return, and create a module documentation file.

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![Akash\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@Akash\_Agarwal](https://forum.ansible.com/u/Akash_Agarwal)\
**Post date:** [March 20, 2018, 4:47am UTC](https://forum.ansible.com/t/urgent-help-ansible-for-fetching-and-comparing-windows-os-configuration-performance-stats/26939/5 "2018-03-20T04:47:59Z")

</div>

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Akash\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@Akash\_Agarwal](https://forum.ansible.com/u/Akash_Agarwal)\
**Post date:** [March 20, 2018, 6:46am UTC](https://forum.ansible.com/t/urgent-help-ansible-for-fetching-and-comparing-windows-os-configuration-performance-stats/26939/6 "2018-03-20T06:46:18Z")

</div>

Hi All,

I want to store the data collected by Ansible from remote machines and then use the data for real time analysis, for Machine learning algorithms, etc. What data storage mechanism should I be using? Examples can be MongoDB , etc ?

Thanks,  
Akash
