# Ansible Playbook is failing to read a config file on windows

**URL:** <https://forum.ansible.com/t/ansible-playbook-is-failing-to-read-a-config-file-on-windows/3107>\
**Category:** Get Help\
**Tags:** windows, playbook, awx, collections\
**Created:** [December 30, 2023, 4:11pm UTC](https://forum.ansible.com/t/ansible-playbook-is-failing-to-read-a-config-file-on-windows/3107 "2023-12-30T16:11:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![husnain\_taja](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@husnain\_taja](https://forum.ansible.com/u/husnain_taja)\
**Post date:** [December 30, 2023, 4:11pm UTC](https://forum.ansible.com/t/ansible-playbook-is-failing-to-read-a-config-file-on-windows/3107/1 "2023-12-30T16:11:27Z")

</div>

Hi,

I have ansible playbook which I am executing it via AWX.This playbook tries to read file on windows machine.I have created a credential in AWX where I provided username and password.I did’nt provided any Privilege Escalation Method.

I am importing this playbook in another playbook:-  
- name: include detail agent playbook - Windows  
import\_playbook: detail\_agent\_telegraf\_win.yml  
when:  
- (action == ‘log’ or action == ‘list’ or action == ‘view’ or action == ‘view\_tgf\_conf’) and (deployed\_by != ‘Cloud-Autodeployment’)  
- hostvars[server][“platform\_os”] == ‘Windows’

This is the playbook:-

```auto
---
- name: Play to perform read operations on different telegraf files
  hosts: "{{ server }}"

  tasks:
    - name: View Agent Conf File On Windows
      win_command: type C:\InfluxData\Telegraf\telegraf.conf
      when:
        - action == 'view_tgf_conf'

```

I am getting this error from the playbook  
{“msg”: “The powershell shell family is incompatible with the sudo become plugin”}

But Privilege Escalation is enabled on the job template level

This are the host\_vars for the windows host:-

```auto
ansible_user: sec_cred
ansible_connection: winrm
ansible_winrm_transport: basic
ansible_port: '5986'
ansible_winrm_server_cert_validation: ignore

```

Can you plz provide me the solution.I am new to ansible.Appreciate the help

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [December 31, 2023, 4:28am UTC](https://forum.ansible.com/t/ansible-playbook-is-failing-to-read-a-config-file-on-windows/3107/2 "2023-12-31T04:28:59Z")

</div>

> [@husnain\_taja](#):
>
> I did’nt provided any Privilege Escalation Method

Hi, could you please try specifying `runas` as `Privilege Escalation Method` on machine credentials for Windows-based hosts, or addding `ansible_become_method: runas` as host variables.
