Guide for deploying Visual Studio 2017 Community on a network via Group Policies
Prepare Visual Studio 2017 Community Installation Files
Download the Visual Studio Community 2017 bootstrap installer from https://aka.ms/vs/15/release/vs_community.exe (the installer is about 1.2 MB)
Create an Offline Installation folder
Navigate to your download folder and open up a command prompt (Shift + Right Click; choose Open PowerShell window here)
The Visual Studio 2017 bootstrap installer can be run with command line arguments to create an offline installer with the components you require. Note the full install of Visual Studio 2017 with all the available components is over 32GB. The offline installer folder is created with the --layout switch. The --add switch tells the installer which workloads and components to add to the offline installer (if you don't specify any components, all 32GB will be downloaded).
The most basic offline install folder without any optional components is built with the following command:
.\vs_community.exe --layout "c:\VS2017Community" --add Microsoft.VisualStudio.Workload.CoreEditor --lang en-US
A full list of the available workload and component IDs here: https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community
Create Visual Studio 2017 Silent Installer
The vs_community.exe installer reads parameters from the file Response.json This file includes silent install switches and selections for which components to install at install time.
Open the file Response.json in the offline installer folder (c:\VS2017Commnunity if you used the command shown above to build the offline installer folder). I suggest using a text editor that can properly format .json files - I recommend NotePad++ with the JSON Viewer plugin installed. The modified example below runs the installer in 'quite' mode - this mode shows no dialogue boxes to the path c:\VS2017
{"installChannelUri":".\\ChannelManifest.json",
"channelUri":"https://aka.ms/vs/15/release/channel",
"installCatalogUri":".\\Catalog.json",
"channelId":"VisualStudio.15.Release",
"productId":"Microsoft.VisualStudio.Product.Community",
"add":["Microsoft.VisualStudio.Workload.CoreEditor"],
"addProductLang":["en-US"],
"installPath": "C:\\VS2017",
"quiet": true,
"passive": false,
"includeRecommended": true,
"norestart": true
}
Deploy Silent installer with Startup Script
Create a new powershell script file in the c:\VS2017Commnunity folder - call it install.ps1
An example of how I've setup my silent install script is below. Note that you need to install the certificates into each machine before running the vs_community.exe installer.
If(!(Test-Path -Path "c:\VS2017")){
#Import required certificates
Get-ChildItem -Path "$PSScriptRoot\certificates" -Filter *.p12 | Import-PfxCertificate -CertStoreLocation cert:\localMachine\my
#Run the installer
Start-Process -FilePath "$PSScriptRoot\vs_community.exe" -ArgumentList "--quiet --wait --norestart" -Wait
}Else{
}
Copy over the VS2017Community folder into your deployment share and add the install.ps1 script as a startup powershell script in a group policy object GPO.
Uninstalling Visual Studio 2017 Community
You can uninstall the whole installation by running the following command:
'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe' uninstall --installPath C:\VS2017\ --quiet
References