How to update multiple Visual Studio instances (IDE/Build Tools) and Visual Studio Installer from Ansible


Visual Studio Installer is standalone application responsible for updating Visual Studio IDE and Build Tools. It can be executed from CMD with args to update all local installations. However, this installer (either setup.exe or vs_installer_exe ) is running in somewhat asynchronous mode, where it outputs to STD_OUT, but returns you the control of CMD – factically making the process not awaitable.

DOCS are mentioning arg --wait , which is however usable only on bootstrappers:

Optional: The process waits until the install is completed before returning an exit code. wait is useful when automating installations where one needs to wait for the install to finish to handle the return code from that install. The --wait parameter can only be passed into the bootstrapper; the installer (setup.exe) doesn’t support it. It is useful when updating layouts. More examples can be found here.

Bootstrapper is a small file representing particular edition (one of the future local installations) of either IDE or Build tools:

In each example, vs_enterprise.exe, vs_professional.exe, and vs_community.exe represent the respective edition of the Visual Studio bootstrapper, which is the small (~ 1MB) file that initiates the download process. If you’re using a different edition, substitute the appropriate bootstrapper name.

Now the scenario I would like to automate is to update multiple installations of IDEs/Build Tools (i.e. IDEs VS 2017+2019+2022 and Build tools 2017+2019+2022) and VS Installer across multiple machines (100+) from Ansible.

If running manually, I can easily run following to update all of those:

"C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe" updateAll --quiet --norestart --nocache

However this leaves the CMD in some awaitable state / it still outputs something to STD_OUT while allowing me to type new commands. It doesn’t support --wait arg (as mentioned above/in docs).

When run from Ansible, the script run ends immediatelly, but the process installation is happening in the background on the machine – this is bad since I need to know when the installation/update process ends, so I can continue with other tools/requirements.

Few solutions I was thinking about, but sound as unnecesarry too much work:

  • Download bootstrappers for all instances (on all machines) and run them 1by1 to install updates

  • Would somehow using single bootstrapper to update all of them suit this?

  • Would CMD/PS allow to run this as some awaitable command that would simply wrap this around and waited for process to end?

  • Recommendation for any kind of Ansible library for VS commands instead of running this from CMD?

What is the best approach to handle updating multiple VS instances and VS Installer from Ansible?

Leave a Reply

Your email address will not be published. Required fields are marked *