• Rachel Cooper

Deploying Visual Studio with Microsoft Endpoint Manager/Intune

I've started to deploy out applications with Intune as part of our deployment of Endpoint Manager & Microsoft 365 E5. One of the more challenging pieces of software to deploy was Microsoft Visual Studio 2019. I work for a company that has a standard configuration for Visual Studio for all of our software engineers. Luckily the Software Engineering department documented exactly what should be installed and has a standard .vsconfig file. What became an issue was incorporating the config file into the install through Intune.

After lots of testing with the documented arguments from Microsoft, the install worked great but not when using a .vsconfig file. The command line install needs the entire path to the .vsconfig file. The issue is that although the installer and .vsconfig file is packaged into a .intunewin file, the file is unpacked on the computer into a team file with a random GUID folder name. So it's impossible to know the path for the .vsconfig file.

After some extensive Binging and Googling I found a great article: "Deploying File To Workstations With Microsoft Intune" by Usman Ghani. I used his example to copy the .vsconfig file to the C:\Windows\Temp file and then launch the install.

Here are the Step by Step Instructions:

1. Create a folder on your C drive that you're going to use as your source folder. I usually use C:\Intune\Source\[Software Name]. In this case, it is C:\Intune\Source\VisualStudio.

2. Copy the installer vs_Enterprise.exe and the .vsconfig file into the VisualStudio folder.

3. Create a new PowerShell script PSscript.ps1 in the VisualStudio folder with the code below:

$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
$Source = “$PSScriptRoot\.vsconfig"
$Destination =C:\windows\Temp\”

Copy-Item -Path $Source -Destination $Destination –Recurse -Force

Start-Process -FilePath "vs_Enterprise.exe" -ArgumentList "--config C:\windows\Temp\.vsconfig --wait -q" -Wait

You'll see how the .vsconfig file is being pulled from the folder where the script is run and the destination is set to the C:\windows\Temp folder. Also, the Start-Process command is running the installer with the command line arguments that point to the .vsconif file and are set to wait and install in quiet mode.

4. Create an install.cmd batch file in the VisualStudio folder. This is the file that you'll use to kick off the install from Intune.

SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%PSscript.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command %PowerShellScriptPath%

5. If you haven't already, download the IntuneWinAppUtil.exe from GitHub. I usually save this to the C:\Intune folder I created in Step 1.

6. Open up the IntuneWinAppUtil.exe file and enter the values below:

You'll see that a new folder was created, C:\Intune\Package\VisualStudio. This is where the install.intuenwin file is created.

7. Open and sign in to Microsoft Endpoint Manager.

8. Go to Apps > Windows

9. Select the Add button

10. Select Windows app (Win32) from the App type drop-down box and select the Select button.

11. Select the "Select app package file" link to select the install.intuenwin file in C:\Intune\Package\VisualStudio folder.

12. Enter the required information on the App Information page and select the Next button. (I do suggest you add a logo to the logo section of the page, it just looks better to the audience.)

13. On the Program screen on the Install command box enter install.cmd so the batch file and script will run for the install of the software.

For the Uninstall command box enter the code below. This will force an uninstall of Visual Studio and the Visual Studio installer.

C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe -f

The Install behavior can be set as System.

14. On the Requirments screen set whatever systems requirements you'd like. Here's my example.

15. On the Detection rules screen you can set the system to look for the Visual Studio exe file in Program Files. Just be aware you can use system variables, I didn't (got lazy).

16. You can skip the Dependences screen.

17. On the Assignments screen you assign what groups are required to have the Visual Studio installed or just have it available in the Company Portal. Also, you can force an uninstall of the Visual Studio.

18. On the Review + creat screen you can check your settings and select the Create button to create your app. It can take a bit for the app to upload and to be available in the Company Portal.

©2019 by Systems Maven