# Run Postgres queries on a Windows target?

**URL:** <https://forum.ansible.com/t/run-postgres-queries-on-a-windows-target/35396>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 23, 2021, 3:35pm UTC](https://forum.ansible.com/t/run-postgres-queries-on-a-windows-target/35396 "2021-06-23T15:35:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [June 23, 2021, 3:35pm UTC](https://forum.ansible.com/t/run-postgres-queries-on-a-windows-target/35396/1 "2021-06-23T15:35:52Z")

</div>

I’m aware that the postgres\_\* modules only run on Linux. Is there a way to run Postgres queries on a Windows target? For example, I want to CREATE DATABASE myDB

Thanks,  
Chris

---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [June 24, 2021, 2:52pm UTC](https://forum.ansible.com/t/run-postgres-queries-on-a-windows-target/35396/2 "2021-06-24T14:52:02Z")

</div>

I just put my queries in a \*.sql file, for example

create\_db.sql  
CREATE DATABASE myDB

and do

- name: Create DB  
win\_command: psql -U postgres -f create\_db.sql
