title: Visual Studio 2017 - Create an offline installation through network share and Ansible Playbook
body: <p>I'm attempting to create an offline Visual Studio 2017 installation with network share and Ansible.</p>
  
  <p>I'm having a hard time figuring out what exactly is going on since the installation loops(?) without much logging, the logs are often vague and more than often tells me that the bootstrapper is downloading files from Microsoft. </p>
  
  <p>I'm wondering if there are easier ways to do this with Ansible.</p>
  
  <p>I've used the following guides from Microsoft to try to make sense of things:</p>
  
  <ul>
  <li><a href="https://docs.microsoft.com/en-us/visualstudio/install/create-a-network-installation-of-visual-studio?view=vs-2017" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/visualstudio/install/create-a-network-installation-of-visual-studio?view=vs-2017</a></li>
  <li><a href="https://docs.microsoft.com/en-us/visualstudio/install/automated-installation-with-response-file?view=vs-2017" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/visualstudio/install/automated-installation-with-response-file?view=vs-2017</a></li>
  </ul>
  
  <p>Possibly problematic issue: <a href="https://github.com/MicrosoftDocs/visualstudio-docs/issues/1531" rel="nofollow noreferrer">https://github.com/MicrosoftDocs/visualstudio-docs/issues/1531</a></p>
  
  <p>The setup:</p>
  
  <p>I've created a network share that is available as so:
  \\Share\VisualStudio2017\</p>
  
  <p>The share has (currently) no restriction while testing, so that means "everyone" can read its content. </p>
  
  <p>The share is populated by the following layout command</p>
  
  <pre><code>vs_enterprise.exe --layout \\&lt;server&gt;\Share\Development\VisualStudio2017 --lang en-US --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.Universal --add Microsoft.VisualStudio.Workload.NetWeb Microsoft.VisualStudio.Workload.Node --add Microsoft.VisualStudio.Workload.NetCrossPlat --add Microsoft.VisualStudio.Workload.NetCoreTools --includeRecommended
  </code></pre>
  
  <p>Updated the Response.json (in the share) to </p>
  
  <pre><code>{
      "installChannelUri": "\\&lt;server&gt;\\Share\\Development\\VisualStudio2017\\ChannelManifest.json",
      "channelUri": "\\&lt;server&gt;\\Share\\Development\\VisualStudio2017\\ChannelManifest.json",
      "installCatalogUri": "\\&lt;server&gt;\\Share\\Development\\VisualStudio2017\\Catalog.json",
      "channelId": "VisualStudio.15.Release",
      "productId": "Microsoft.VisualStudio.Product.Enterprise",
      "add": [
          "Microsoft.VisualStudio.Workload.ManagedDesktop;includeRecommended",
          "Microsoft.VisualStudio.Workload.NativeDesktop;includeRecommended",
          "Microsoft.VisualStudio.Workload.NetCoreTools;includeRecommended",
          "Microsoft.VisualStudio.Workload.NetCrossPlat;includeRecommended",
          "Microsoft.VisualStudio.Workload.NetWeb;includeRecommended",
          "Microsoft.VisualStudio.Workload.Node;includeRecommended",
          "Microsoft.VisualStudio.Workload.Universal;includeRecommended"
      ],
      "addProductLang": [
          "en-US"
      ]
  }
  </code></pre>
  
  <p>The share is combined with the role:</p>
  
  <pre><code>- name: Install Visual Studio 2017 
    win_package: 
       path: '\\&lt;server&gt;\share\Development\VisualStudio2017\vs_enterprise.exe'
       state: present
       product_id: Microsoft.VisualStudio.Product.Enterprise
       channel_id: VisualStudio.15.Release
       user_name: &lt;DOMAIN&gt;\&lt;USERNAME&gt; 
       user_password: &lt;PASSWORD&gt;
       arguments: 
  #        - --quiet
          - --wait
          - --norestart
  #        - --add Microsoft.VisualStudio.Workload.ManagedDesktop 
  #        - --add Microsoft.VisualStudio.Workload.NativeDesktop 
  #        - --add Microsoft.VisualStudio.Workload.Universal 
  #        - --add Microsoft.VisualStudio.Workload.NetWeb Microsoft.VisualStudio.Workload.Node 
  #        - --add Microsoft.VisualStudio.Workload.NetCrossPlat 
  #        - --add Microsoft.VisualStudio.Workload.NetCoreTools 
  #        - --includeRecommended
  </code></pre>
  
  <p>I'm running the playbook with the command with the verbose setting </p>
  
  <pre><code>ansible-playbook -i hosts utvClients.yaml -vvvv
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>TASK [VisualStudio2017 : Install Visual Studio 2017] ******************************************************************************************************************************************************
  task path: /mnt/d/dev/Ansible/roles/VisualStudio2017/tasks/main.yaml:2
  Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_package.ps1
  &lt;192.168.56.101&gt; ESTABLISH WINRM CONNECTION FOR USER: Ansible on PORT 5986 TO 192.168.56.101
  checking if winrm_host 192.168.56.101 is an IPv6 address
  EXEC (via pipeline wrapper)
  </code></pre>
  
  <p>The bootstrapper log on the host in the path C:\users\\AppData\Local\Temp\dd_bootstrapper_.log says this:</p>
  
  <pre><code>Beginning of the log. Start Time: 3/6/2019 9:43:56 AM
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: Commandline arguments = --wait,--norestart,--path cache="\\&lt;server&gt;\share\Development\VisualStudio2017\",--env,_SFX_CAB_EXE_PACKAGE:C:\Users\Ansible\tyzrpvdy.v4j _SFX_CAB_EXE_ORIGINALWORKINGDIR:C:\Users\Ansible
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: Parent process name = tyzrpvdy
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: Parent process product version = 15.9.28307.423
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: CampaignId = 
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: ResponseId not available in 'vs_setup_bootstrapper.config'. Trying to parse filename.
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: loading config settings: -update --update --layout -offline --offline --locale --layout --originalworkingdir --installLayoutPath --env
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: DownloadURL = https://aka.ms/vs/15/release/installer
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: InstallLocation = C:\Program Files (x86)\Microsoft Visual Studio\Installer
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: OfflineFilePath = 
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: LayoutLocation = 
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: ExecutableArguments = /finalizeInstall install --in "C:\ProgramData\Microsoft\VisualStudio\Packages\_bootstrapper\vs_setup_bootstrapper_201903060943571796.json" --norestart "--path cache="\\&lt;server&gt;\share\Development\VisualStudio2017\"" --locale en-US --activityId "d3c1a7c6-22ba-42af-9ce9-7ede1608e7be"
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: OSVersion = Microsoft Windows NT 10.0.17763.0
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: Starting to detect the existing VS and .Net...
  VisualStudio Bootstrapper:3/6/2019 9:43:57 AM: Finished detecting the existing VS and .Net
  </code></pre>
  
  <p>First off: DownloadUrl is still set to aka.ms? 
  Am I not overriding it properly? Are there more things to consider?</p>