# \[Windows\] Install visual studio

**URL:** <https://forum.ansible.com/t/windows-install-visual-studio/26565>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [January 25, 2018, 10:25am UTC](https://forum.ansible.com/t/windows-install-visual-studio/26565 "2018-01-25T10:25:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremie\_Levy](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Jeremie\_Levy](https://forum.ansible.com/u/Jeremie_Levy)\
**Post date:** [January 25, 2018, 10:25am UTC](https://forum.ansible.com/t/windows-install-visual-studio/26565/1 "2018-01-25T10:25:46Z")

</div>

Hi

It seems i need to wait a bit after the Visual studio installation.  
It stated as failed because it couldn’t remove the temporary install file (web install file) - VS was installed !

I’m using win\_package and i’m not interested in using the raw module since i need the win\_package capabilities.  
A workaround would be to have: if you can’t remove the file, it’s not a failure and keep going (which i don’t know how to do yet :))

`

task path: /ansible/scripts/vs2012.yaml:23  
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win\_package.ps1  
 ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5986 TO hasjrwts02  
creating Kerberos CC at /tmp/tmpJ\_QHmz  
calling kinit for principal ansible  
kinit succeeded for principal ansible  
 WINRM CONNECT: transport=kerberos endpoint=[https://hasjrwts02:5986/wsman](https://hasjrwts02:5986/wsman)  
 WINRM OPEN SHELL: 23C2DB3A-DC34-4DA0-A019-7CD45579D735  
EXEC (via pipeline wrapper)  
 WINRM EXEC ‘PowerShell’ [‘-NoProfile’, ‘-NonInteractive’, ‘-ExecutionPolicy’, ‘Unrestricted’, ‘-’]  
 WINRM RESULT u’\<Response code 1, out “”, err “An error occurred wh”\>’  
 WINRM STDOUT  
 WINRM STDERR An error occurred while creating the pipeline.

- CategoryInfo : NotSpecified: (🙂 , ParentContainsErrorRecordException
- FullyQualifiedErrorId : RuntimeException

Exception calling “Run” with “1” argument(s): “Exception calling “Invoke” with “0” argument(s): “The running command  
stopped because the preference variable “ErrorActionPreference” or common parameter is set to Stop: Cannot remove item  
C:\Users\ansible\r4muzag1.gdd: Access to the path ‘C:\Users\ansible\r4muzag1.gdd’ is denied.””  
At line:47 char:5

- $output = $entrypoint.Run($payload)
- 

```auto

```

- CategoryInfo : NotSpecified: (🙂 , ParentContainsErrorRecordException
- FullyQualifiedErrorId : ScriptMethodRuntimeException

WINRM CLOSE SHELL: 23C2DB3A-DC34-4DA0-A019-7CD45579D735  
fatal: [hasjrwts02]: FAILED! =\> {  
“changed”: false,  
“module\_stderr”: “An error occurred while creating the pipeline.\r\n + CategoryInfo : NotSpecified: (🙂 , ParentContainsErrorRecordException\r\n + FullyQualifiedErrorId : RuntimeException\r\n \r\nException calling "Run" with "1" argument(s): "Exception calling "Invoke" with "0" argument(s): "The running command \r\nstopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot remove item \r\nC:\Users\ansible\r4muzag1.gdd: Access to the path ‘C:\Users\ansible\r4muzag1.gdd’ is denied.""\r\nAt line:47 char:5\r\n+ $output = $entrypoint.Run($payload)\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \r\n + CategoryInfo : NotSpecified: (🙂 , ParentContainsErrorRecordException\r\n + FullyQualifiedErrorId : ScriptMethodRuntimeException\r\n \r\n”,  
“module\_stdout”: “”,  
“msg”: “MODULE FAILURE”,  
“rc”: 1  
}  
to retry, use: --limit @/ansible/scripts/vs2012.retry

`

Any idea please 🙂 ?

---

<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:** [January 25, 2018, 9:03pm UTC](https://forum.ansible.com/t/windows-install-visual-studio/26565/2 "2018-01-25T21:03:50Z")

</div>

I have successfully installed visual studio using win\_chocolatey in the past (with become escalating to run as local administrator). Might be worth trying that.  
I suspect running with become might fix your problem as clearly its upset about having access to `C:\\Users\\ansible\\r4muzag1.gdd`

Hope this is some help,

Jon

---

<div class="post-metadata">

**Author:** ![Jeremie\_Levy](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Jeremie\_Levy](https://forum.ansible.com/u/Jeremie_Levy)\
**Post date:** [January 28, 2018, 1:33pm UTC](https://forum.ansible.com/t/windows-install-visual-studio/26565/3 "2018-01-28T13:33:05Z")

</div>

Seems there is no become in the win\_package module…

---

<div class="post-metadata">

**Author:** ![Varun\_Chopra](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@Varun\_Chopra](https://forum.ansible.com/u/Varun_Chopra)\
**Post date:** [January 28, 2018, 4:47pm UTC](https://forum.ansible.com/t/windows-install-visual-studio/26565/4 "2018-01-28T16:47:48Z")

</div>

That's not how become works. You can set become: yes at the task and play level, not module level.

---

<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:** [January 28, 2018, 4:55pm UTC](https://forum.ansible.com/t/windows-install-visual-studio/26565/5 "2018-01-28T16:55:06Z")

</div>

There’s windows-specific documentation about using become here: [https://docs.ansible.com/ansible/devel/become.html#become-and-windows](https://docs.ansible.com/ansible/devel/become.html#become-and-windows)

---

<div class="post-metadata">

**Author:** ![Varun\_Chopra](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@Varun\_Chopra](https://forum.ansible.com/u/Varun_Chopra)\
**Post date:** [January 28, 2018, 4:59pm UTC](https://forum.ansible.com/t/windows-install-visual-studio/26565/6 "2018-01-28T16:59:32Z")

</div>

Yes, and?

---

<div class="post-metadata">

**Author:** ![Jeremie\_Levy](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Jeremie\_Levy](https://forum.ansible.com/u/Jeremie_Levy)\
**Post date:** [January 29, 2018, 6:58am UTC](https://forum.ansible.com/t/windows-install-visual-studio/26565/7 "2018-01-29T06:58:26Z")

</div>

To avoid this issue and since my user is already admin on the server, i’ve just download the file first instead of installing over http url.  
Thanks!

---

<div class="post-metadata">

**Author:** ![aaron](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@aaron](https://forum.ansible.com/u/aaron)\
**Post date:** [February 13, 2018, 2:05am UTC](https://forum.ansible.com/t/windows-install-visual-studio/26565/8 "2018-02-13T02:05:20Z")

</div>

+1 for Chocolatey. Way easier to manage updates and install software and it pulls straight from the vendor if you use an internet package versus your own chocolatey repository.
