# win\_stat poses an error when i try to get info about a file symbolic link actively in use by a processor

**URL:** <https://forum.ansible.com/t/win-stat-poses-an-error-when-i-try-to-get-info-about-a-file-symbolic-link-actively-in-use-by-a-processor/20939>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [March 21, 2016, 5:48am UTC](https://forum.ansible.com/t/win-stat-poses-an-error-when-i-try-to-get-info-about-a-file-symbolic-link-actively-in-use-by-a-processor/20939 "2016-03-21T05:48:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishan\_jain](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@ishan\_jain](https://forum.ansible.com/u/ishan_jain)\
**Post date:** [March 21, 2016, 5:48am UTC](https://forum.ansible.com/t/win-stat-poses-an-error-when-i-try-to-get-info-about-a-file-symbolic-link-actively-in-use-by-a-processor/20939/1 "2016-03-21T05:48:53Z")

</div>

I am trying to check if some symbolic links exists or not on a windows 2012 R2 machine using win\_file module. It works fine in case of directory symbolic links but poses an error when the path specified is a file symbolic link that is actively being used by a process. This link is a link to jar file and here is what i am using in ansible:

win\_stat: path=E:\folder\link2\some\_dir\link3.jar

I get the following error because the file is actively in use:

“msg”: {  
“changed”: false,  
“exception”: “At C:\Users\Ishan\AppData\Local\Temp\ansible-tmp-1458122016.24-112690440585191\win\_stat.ps1:231 char:9\r\n+ $fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System. …\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ”,  
“failed”: true,  
“msg”: “Exception calling "Open" with "3" argument(s): "The process cannot access the file ‘E:\folder\link2\some\_dir\link3.jar’ because it is being used by another process."”  
}

The script i am writing will need to check if a sym link exists and most of the time it will check that on an active jar file link. How can i make it not pose an error ?

---

<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 21, 2016, 1:49pm UTC](https://forum.ansible.com/t/win-stat-poses-an-error-when-i-try-to-get-info-about-a-file-symbolic-link-actively-in-use-by-a-processor/20939/2 "2016-03-21T13:49:11Z")

</div>

It looks like a fix for this has already been made in latest development version of ansible.

[https://github.com/ansible/ansible/blob/devel/lib/ansible/module\_utils/powershell.ps1#L214](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/powershell.ps1#L214)

Are you able to try latest development version?

Jon

---

<div class="post-metadata">

**Author:** ![ishan\_jain](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@ishan\_jain](https://forum.ansible.com/u/ishan_jain)\
**Post date:** [March 22, 2016, 8:42am UTC](https://forum.ansible.com/t/win-stat-poses-an-error-when-i-try-to-get-info-about-a-file-symbolic-link-actively-in-use-by-a-processor/20939/3 "2016-03-22T08:42:01Z")

</div>

I will try with the development branch and will post the results.  
Do we have an official image of Ansible’s latest devel branch on docker hub ?

---

<div class="post-metadata">

**Author:** ![Uditha\_Desilva](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@Uditha\_Desilva](https://forum.ansible.com/u/Uditha_Desilva)\
**Post date:** [March 23, 2016, 11:47am UTC](https://forum.ansible.com/t/win-stat-poses-an-error-when-i-try-to-get-info-about-a-file-symbolic-link-actively-in-use-by-a-processor/20939/4 "2016-03-23T11:47:07Z")

</div>

It was made clear at AnsibleFest London that Ansible no longer support any Docker images thereof, so you’ll have to roll your own.
