top of page
  • Writer's pictureRachel 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.

17,782 views3 comments


Feb 11, 2022

hi. I am traying to do the same, but it doesn't work. I have created ps1 scrip and trying to run it. the result is:

Copy-Item : Cannot find drive. A drive with the name '$PSScriptRoot = Split-Path -Parent -Path


$Source = “$PSScriptRoot\.vsconfig"

$Destination = “C' does not exist.

At line:5 char:1

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

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: ($PSScriptRoot =...estination = “C:String) [Copy-Item], DriveNotFoundExc


+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.CopyItemCommand

Start-Process : This command cannot be run due to the error: The system cannot find the file specified.

At line:7 char:1

+ Start-Process -FilePath "vs_Enterprise.exe" -ArgumentList "--config C ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException

+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand


Jan 13, 2022

Would anyone know how to insert a product key into the PS script?

Thank you for the guide, worked perfectly. Just need to be able to add the product key during installation or I think I will have to run a separate script after installation is complete.

Jun 20, 2022
Replying to

Add it to the powershell script:

$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_professional.exe" -ArgumentList "--config C:\windows\Temp\.vsconfig --wait -q --productKey XXXXXXXXXXXXXXXXXXXXXXXXX" -Wait

Post: Blog2_Post
bottom of page