# How to make symbolic links in windows via Ansible ?

**URL:** <https://forum.ansible.com/t/how-to-make-symbolic-links-in-windows-via-ansible/20538>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [February 11, 2016, 11:59am UTC](https://forum.ansible.com/t/how-to-make-symbolic-links-in-windows-via-ansible/20538 "2016-02-11T11:59:46Z")\
**Posts on this page:** 3\
**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:** [February 11, 2016, 11:59am UTC](https://forum.ansible.com/t/how-to-make-symbolic-links-in-windows-via-ansible/20538/1 "2016-02-11T11:59:46Z")

</div>

I am trying to make a lot symbolic links for my directories and files and manually i use mklink command to make them. Oddly enough, this command requires admin level privileges to create links.

How can i use mklink via ansible with admin privileges to create symbolic links ?

---

<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:** [February 11, 2016, 4:45pm UTC](https://forum.ansible.com/t/how-to-make-symbolic-links-in-windows-via-ansible/20538/2 "2016-02-11T16:45:18Z")

</div>

Obviously you will need to connect as an Administrator user.

You don’t mention which version of windows you are controlling but you may just need to temporarily disable UAC prompt for Administrator users.

On Server 2012 the setting for this is in

HKEY\_LOCAL\_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System

ConsentPromptBehaviorAdmin  
0

set it back to 2 to restore current default behaviour.

Hope this helps. I have not used mklink though.

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:** [February 12, 2016, 9:07am UTC](https://forum.ansible.com/t/how-to-make-symbolic-links-in-windows-via-ansible/20538/3 "2016-02-12T09:07:08Z")

</div>

Hi Jon,

I am using windows server 2012 R2. Disabling UAC doesn’t seem like a good idea, specially with my automation scripts on a regular basis. I am connecting via admin account obviously but that doesn’t seem to be enough for making a symlink. I will have to start a command shell using ‘Run as admin’.
