# Very simple copy file command for Windows

**URL:** <https://forum.ansible.com/t/very-simple-copy-file-command-for-windows/17936>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [April 8, 2015, 11:44pm UTC](https://forum.ansible.com/t/very-simple-copy-file-command-for-windows/17936 "2015-04-08T23:44:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Brandes](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Eric\_Brandes](https://forum.ansible.com/u/Eric_Brandes)\
**Post date:** [April 8, 2015, 11:44pm UTC](https://forum.ansible.com/t/very-simple-copy-file-command-for-windows/17936/1 "2015-04-08T23:44:25Z")

</div>

There’s a gist floating around of a simple copy module for windows + ansible, but I can’t get it to work. I can use New-Item to create a file on the remote host using this same pattern, but Copy-Item is failing silently. Any ideas?

(This is the entirety of the copy script)  
#!powershell

# This file is part of Ansible

---

<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:** [April 10, 2015, 8:39am UTC](https://forum.ansible.com/t/very-simple-copy-file-command-for-windows/17936/2 "2015-04-10T08:39:50Z")

</div>

Looking that the port I did for [https://github.com/ansible/ansible-modules-core/pull/384/files](https://github.com/ansible/ansible-modules-core/pull/384/files) I can see I wound up putting a

New-Item -Force $dest -Type file;

before the Copy-Item

I’d be grateful if you could try the modules from here [https://github.com/ansible/ansible-modules-core/pull/384/files](https://github.com/ansible/ansible-modules-core/pull/384/files) - which you should be able to use if you are on Ansible 1.9 or later.

If you are still getting failures please can you share an example playbook, ansible version and platform.

Many thanks,

Jon
