# Ansible win\_copy or win\_file error "The given path's format is not supported"

**URL:** <https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [March 14, 2018, 6:50pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000 "2018-03-14T18:50:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Augusto\_Canessa](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@Augusto\_Canessa](https://forum.ansible.com/u/Augusto_Canessa)\
**Post date:** [March 14, 2018, 6:50pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000/1 "2018-03-14T18:50:29Z")

</div>

I’m having a problem creating or copying files from my Ansible box to windows. Commands like reboot work fine. But any command that involves a PATH gives me this error.

My command (C&P from Ansible’s site)

- name: Touch a file (creates if not present, updates modification time if present)  
win\_file:  
path: C:\foo.conf  
state: touch

The error:

fatal: [XX.XXX.XX.112]: FAILED! =\> {  
“failed”: true,  
“msg”: “#\< CLIXML\r\n\<Objs Version="1.1.0.1" xmlns="[http://schemas.microsoft.com/powershell/2004/04\](http://schemas.microsoft.com/powershell/2004/04%5C)”\>\<S S="Error"\>Exception calling "Create" with "1" argument(s): "The given path’s format is no\_x000D\_\_x000A\_\<S S="Error"\>t supported."_x000D\_\_x000A_\<S S="Error"\>At line:6 char:31\_x000D\_\_x000A\_\<S S="Error"\>+ $fd = [System.IO.File]::Create \<\<\<\< ($path)_x000D\_\_x000A_\<S S="Error"\> + CategoryInfo : NotSpecified: (🙂 , ParentContainsErrorRecordE _x000D\_\_x000A_\<S S="Error"\> xception\_x000D\_\_x000A\_\<S S="Error"\> + FullyQualifiedErrorId : DotNetMethodException\_x000D\_\_x000A\_\<S S="Error"\> _x000D\_\_x000A_"  
}

I’ve tried everything, uppercase drive letter, double , quotes. What am I doing wrong here?

Thanks!!

---

<div class="post-metadata">

**Author:** ![David\_Baumann](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@David\_Baumann](https://forum.ansible.com/u/David_Baumann)\
**Post date:** [March 14, 2018, 7:49pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000/2 "2018-03-14T19:49:54Z")

</div>

What is your file encoding of the ansible playbook/varr.. files.

Ansible run only on linux ensure files are encoded with utf8 and a new line format with "LF"

---

<div class="post-metadata">

**Author:** ![Augusto\_Canessa](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@Augusto\_Canessa](https://forum.ansible.com/u/Augusto_Canessa)\
**Post date:** [March 14, 2018, 7:57pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000/3 "2018-03-14T19:57:55Z")

</div>

This is my playbook file. I’ve been using it no problem with the usual linux commands (ie file module). As you see, win\_reboot is there, commented. That one works perfect. I only get the error when a PATH is involved. If I put the wrong path on the linux or windows (src / dest) it event tells me that it can’t find it. It seems that it is complaining about something in the windows path…

Any idea?

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [March 14, 2018, 8:35pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000/4 "2018-03-14T20:35:52Z")

</div>

What version of Ansible are you on? Usually the CLIXML errors are cleaned up in the newer versions of Ansible where a lot of these paths issues have been fixed. Using a backslash without quotes or just single quotes is more than fine, I’m able to run a task like

`

- win\_copy:  
src: /tmp/file.txt  
dest: C:\temp\file.txt  
`

We have some docs around path formatting for Windows that should work from 2.2/2.3 onwards as I’ve used most of those examples in those versions [http://docs.ansible.com/ansible/devel/user\_guide/windows\_usage.html#path-formatting-for-windows](http://docs.ansible.com/ansible/devel/user_guide/windows_usage.html#path-formatting-for-windows).

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Augusto\_Canessa](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@Augusto\_Canessa](https://forum.ansible.com/u/Augusto_Canessa)\
**Post date:** [March 14, 2018, 8:57pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000/5 "2018-03-14T20:57:18Z")

</div>

My version is ansible 2.2.1.0 and pywinrm 0.3.0 (Also tried 0.2.2 and 0.3.0b1). I am going to have a look at the link, but I am sure I’ve tried several of those variants.

Any ideas? Thanks!!

---

<div class="post-metadata">

**Author:** ![Augusto\_Canessa](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@Augusto\_Canessa](https://forum.ansible.com/u/Augusto_Canessa)\
**Post date:** [March 14, 2018, 9:08pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000/6 "2018-03-14T21:08:53Z")

</div>

I think I might have found a potential reason for the issue! I am testing this on a VM that I’ve just created. No windows updates have been installed and I see “DotNetMethodException” as part of the error message.

fatal: [XXXXXXXXXXX]: FAILED! =\> {  
“failed”: true,  
“msg”: “#\< CLIXML\r\n\<Objs Version="1.1.0.1" xmlns="[[http://schemas.microsoft.com/powershell/2004/04\](http://schemas.microsoft.com/powershell/2004/04%5C)]([http://schemas.microsoft.com/powershell/2004/04\](http://schemas.microsoft.com/powershell/2004/04%5C))”\>\<S S="Error"\>Exception calling "Create" with "1" argument(s): "The given path’s format is no\_x000D\_\_x000A\_\<S S="Error"\>t supported."_x000D\_\_x000A_\<S S="Error"\>At line:6 char:31\_x000D\_\_x000A\_\<S S="Error"\>+ $fd = [System.IO.File]::Create \<\<\<\< ($path)_x000D\_\_x000A_\<S S="Error"\> + CategoryInfo : NotSpecified: (🙂 , ParentContainsErrorRecordE _x000D\_\_x000A_\<S S="Error"\> xception\_x000D\_\_x000A\_\<S S="Error"\> + FullyQualifiedErrorId : **DotNetMethodException** _x000D\_\_x000A_\<S S="Error"\> _x000D\_\_x000A_"  
}

Maybe the issue is on the Windows VM because of DotNet not being up to date. I am installing updates now. Will let you know!

---

<div class="post-metadata">

**Author:** ![lpescatore](https://avatars.discourse-cdn.com/v4/letter/l/ccd318/32.png) [@lpescatore](https://forum.ansible.com/u/lpescatore)\
**Post date:** [March 14, 2018, 9:11pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000/7 "2018-03-14T21:11:00Z")

</div>

Does Ansible work on a vm pool using DHCP? How do you get the hosts file to scan for addresses?

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [March 14, 2018, 9:16pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000/8 "2018-03-14T21:16:47Z")

</div>

I would doubt that it is .NET but I have been wrong before 🙂 It is saying the exception is coming from a .NET function, in this case [System.IO.File]::Create() [https://msdn.microsoft.com/en-us/library/d62kzs03(v=vs.110).aspx](https://msdn.microsoft.com/en-us/library/d62kzs03(v=vs.110).aspx) and it is saying _the given path’s format is not supported._ I would look at the encoding of your local playbook file and also check to see if there are any hidden whitespace or control characters in an around your path as that could be causing an issue. As for .NET, we support .NET 4.0 and newer which I believe is standard from Server 2012 and onwards. Older hosts need to be upgraded.

---

<div class="post-metadata">

**Author:** ![Augusto\_Canessa](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@Augusto\_Canessa](https://forum.ansible.com/u/Augusto_Canessa)\
**Post date:** [March 16, 2018, 2:37pm UTC](https://forum.ansible.com/t/ansible-win-copy-or-win-file-error-the-given-paths-format-is-not-supported/27000/9 "2018-03-16T14:37:26Z")

</div>

The file seems to be UTF-8:

file -i playbook/esxi.yml

**playbook/esxi.yml: text/plain; charset=utf-8**

I still get the same error:

fatal: [XXX.XXX.XXX.XXX]: FAILED! =\> {  
“failed”: true,  
“msg”: “#\< CLIXML\r\n\<Objs Version="1.1.0.1" xmlns="[[http://schemas.microsoft.com/powershell/2004/04\](http://schemas.microsoft.com/powershell/2004/04%5C)]([http://schemas.microsoft.com/powershell/2004/04\](http://schemas.microsoft.com/powershell/2004/04%5C))”\>\<S S="Error"\>Exception calling "Create" with "1" argument(s): "The given path’s format is no\_x000D\_\_x000A\_\<S S="Error"\>t supported."_x000D\_\_x000A_\<S S="Error"\>At line:6 char:31\_x000D\_\_x000A\_\<S S="Error"\>+ $fd = [System.IO.File]::Create \<\<\<\< ($path)_x000D\_\_x000A_\<S S="Error"\> + CategoryInfo : NotSpecified: (🙂 , ParentContainsErrorRecordE _x000D\_\_x000A_\<S S="Error"\> xception\_x000D\_\_x000A\_\<S S="Error"\> + FullyQualifiedErrorId : DotNetMethodException\_x000D\_\_x000A\_\<S S="Error"\> _x000D\_\_x000A_"  
}

Here is some info about my system:

Python 2.7.13

ansible 2.2.1.0

pip 9.0.1

pywinrm: 0.3.0

Any ideas?

Thanks!
