Automatically apply product keys when deploying Visual Studio
You can apply your product key programmatically as part of a script that is used to automate the deployment of Visual Studio. You can set a product key on a device programmatically either during an installation of Visual Studio or after an installation completes.
Apply the license after installation
You can activate an installed version of Visual Studio with a product key by using the
StorePID.exe utility on the target machines, in silent mode.
StorePID.exe is a utility program that installs with Visual Studio 2017 at the following default location:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE
StorePID.exe with elevated privileges, either by using a System Center agent or an elevated command prompt. Follow it with the product key and the Microsoft Product Code (MPC).
Make sure to include the dashes in the product key.
StorePID.exe [product key including the dashes] [MPC]
The following example shows a command line for applying the license for Visual Studio 2017 Enterprise, which has an MPC of 08860, a product key of
AAAAA-BBBBB-CCCCC-DDDDDD-EEEEEE, and assumes a default installation location:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\StorePID.exe" AAAAA-BBBBB-CCCCC-DDDDDD-EEEEEE 08860
The following table lists the MPC codes for each edition of Visual Studio:
|Visual Studio Edition||MPC|
|Visual Studio Enterprise 2017||08860|
|Visual Studio Professional 2017||08862|
|Visual Studio Test Professional 2017||08866|
StorePID.exe successfully applies the product key, it returns an
%ERRORLEVEL% of 0. If it encounters errors, it returns one of the following codes, depending on the error condition:
Sometimes, things can go wrong. If your Visual Studio installation fails, see Troubleshooting Visual Studio 2017 installation and upgrade issues for step-by-step guidance.
We also offer a live chat (English only) support option for installation-related issues.
Here are a few more support options:
- Report product issues to us via the Report a Problem tool that appears both in the Visual Studio Installer and in the Visual Studio IDE.
- Suggest a feature, track product issues, and find answers in the Visual Studio Developer Community.
- Use your GitHub account to talk to us and other Visual Studio developers in the Visual Studio conversation in the Gitter community.