Powershell Script to Copy and Install.exe Setup to Multiple Remote Server. While installing any software to multiple remote computers, you may required some automation to avoid manual efforts. Installing the Exchange Online PowerShell V2 Module. Before installing the EXO V2 module, you need to change the settings for the PowerShell script execution policy. Open a PowerShell console as an administrator and run the command: Set-ExecutionPolicy RemoteSigned. Confirm the change to the execution policy setting by pressing Y Enter.
If there was a command-line utility that could compete with robocopy in terms of usefulness, it’s PsExec. The Sysinternals PsExec utility is as ubiquitous as they come in an IT admin arsenal. This tool allows administrators to remotely run commands just as if they were on the local computer.
To cover the PsExec tool in depth, it was fitting to cover this coveted tool in an ATA Ultimate Guide. In this guide, you will learn what psexec is, what it’s capable of any many examples of how to use this useful tool.
What is PsExec.exe?
If you’re new to IT or perhaps haven’t had the need to run commands and tools on remote computers, you might not know what psexec is.
PsExec or psexec.exe is a command-line utility built for Windows. It allows administrators to run programs on local and more commonly remote computers. It is a free utility part of the Sysinternals pstools suite built by Mark Russinovich many years ago.
It was built to replace tools like telnet that forced you to open up ports and introduce security vulnerabilities. Nowadays, we have other options like PowerShell Remoting and the
Invoke-Command
PowerShell cmdlet but PsExec still has its place.PsExec allows full interactivity for console application without having to install any software. As you’ll see through this Ultimate Guide, PsExec can launch interactive command prompts, run as local system on remote computers, run commands on multiple computers at once and more.
It supports all versions of Windows since Windows XP. That means, that yes, PsExec on Windows 10 is a thing too. It’s a simple tool to run that works on nearly everything but don’t confuse its simplicity with its capabilities!
Prerequisites
You simply need to be running a modern Windows operating system for PsExec to run on your local computer. However, you’re going to want to run psexec against remote computers. To do that, you’ll need to ensure a few items are in place.
If you don’t have these items in place now or unsure, don’t worry. In the next section, we’ll cover how to write some PowerShell to test your remote computers.
- A modern Windows computer (local)
- File and Printer Sharing open (remote computer, TCP port 445)
- The admin$administrative share available (remote computer)
- You know a local account’s credential (remote computer)
As of this writing, PsExec is at v2.2 and will be the version you’ll be learning about in this article.
Installing PSexec (With Remote Computer Setup)
Technically, you don’t install PsExec since it’s just a command-line utility but close enough. Since no installation is necessary, you simply need to download and extract it from the PsTools zip file. PsExec isn’t available as a standalone utility and is part of the PsTools suite of tools.
Downloading PSExec
You can either extract the ZIP file manually or here’s a handy PowerShell snippet to download and extract PsExec from its pstools ZIP file. Note that this removes all of the other PsTools tools. Many are still handy but we’re not going to cover those in this article.
Remote Computer Configuration
Once you have PsExec downloaded, you’ll then need to ensure any remote computer you’re going to run it on is open. PsExec has simple requirements; File and Printer Sharing enabled and the admin$ administrative share available.
All you have to do, to extend your trial period, is change number in TrialKey element in application.xml. This file is located in /Library/Application Support/Adobe/Adobe Photoshop/AMT. You can navigate there with this command: cd /Library/Application Support/Adobe/Adobe Photoshop./AMT.
Free Photoshop on Mac OS X? Photoshop Trial Reset! 21st of November 2018. Updated Adobe Photoshop 2019. Mac Patcher: link is in reddit thread. Trial reset is not ready yet. For windows users there is already a crack. Adobe Photoshop 2018. Adobe Photoshop Extended Trial for Mac. By Adobe Systems $999.00. Premium Upgrade Developer's Description. By Adobe Systems The Adobe Photoshop family of products is the ultimate. Reset Photoshop's Preferences to Default Settings If you are a Mac user, then you can manually delete the Photoshop's preferences from the following location. (Photoshop will then create a new vanilla preferences file.) Please Quit Photoshop first!
You could go to all of the remote computers, open up the Windows Firewall applet, go to Allowed Apps and enable File and Printer Sharing on all computers as you see below.
Note that File and Printer Sharing is a known security risk so ensure only the Private firewall profile is enabled.
Or you could visit each computer and run the netsh utility to open it up via:
Or you could use PowerShell’s
Set-NetFirewallRule
cmdlet to do it.If you’d rather not visit each computer, you have PowerShell Remoting available and you’re in an Active Directory domain, you could also open up the firewall on many computers at once using the
Invoke-Command
cmdlet.Using PsExec
Before you can run, you need to walk. If you’ve never used PsExec before, you’re in for a treat! Be sure to read this section first to get your feet wet to learn the basics before jumping in the deep end later in this article.
The first time you run PsExec on a new system, you will immediately see the PsExec license agreement come up. You’ll have to click on the Agree button to begin using it.
If you’d like to prevent the license agreement from being displayed, you can silently accept it using the
/accepteula
switch as shown below.You’ll learn a few tricks at silencing this EULA popup on local and remote computers later in the article.
Finding Help
When exploring PsExec, you shouldn’t use any switch at all. When you simply run psexec with no switches, it will return all options and a brief explanation of what each does. All of the options are in the below table for your convenience.
Running a Simple Remote Command
At its most basic, PsExec requires two parameters: a computer name and a command to run. If you have a command to run on the remote computer that doesn’t require any arguments like
hostname
, you can simply add it after the computer name.Note that if you don’t specify a full file path, the command to run must be in the user or system path. Also, if you have a program with spaces in the name, you can always enclose the program in spaces such as “my application.exe”.
You can see below that to execute the
hostname
command on the CONTOSODC1 computer, you define it’s UNC path followed by the command. PSExec will then connect to the remote computer securely, execute the command and return the output. In this case, the hostname
command returned the hostname of the computer which is CONTOSODC1.If the command isn’t
cmd
or another console, PsExec will quickly exit the remote session and return the exit code the remote process returned.Note: The error or exit code returned from psexec is not coming from PsExec itself. Instead, it’s coming from the command that psexec executed on the remote computer.
How PsExec Works on Remote Computers
PsExec goes through a few steps to execute programs on remote computers.
- Create a PSEXESVC.exe file in C:Windows.
- Create and start a Windows service on the remote computer called PsExec.
- Execute the program under a parent process of psexesvc.exe.
- When complete, the PsExec Windows service will be stopped and removed.
When the process doesn’t work 100% correctly you may have to manually remove the service using the sc command.
Running a Simple Local Command
Even though PsExec is best known for running commands on remote computers, you can also run commands locally.
You can run commands locally by simply not providing a computer name like below.
Why would you do this? One reason would be to execute commands as the local SYSTEM account. You can use the
-s
switch to run any command as SYSTEM locally or remotely as you’ll learn more about later.Take a look at the short video below. Notice that you simply need to provide the
-s
switch along with the command interpreter executable for psexec to launch a new command session as NT AUTHORITYSYSTEM.PsExec Commands (Getting More Advanced)
Once you’ve got the basics down, you can then start learning more advanced techniques in psexec. PsExec can do a lot more than just run a single command on a single computer.
Running commands on multiple computers
PsExec isn’t just limited to running commands on one remote computer at a time. This tool also has support to copy programs and run commands on multiple computers at once.
You can run PsExec on multiple computers at once a few different ways.
Comma-separated Computer Names
Typically when running a command on a single remote computer, you will specify a single computer name like
REMOTECOMPUTER
. You can also specify multiple computers separated by commas like below.All Computers in an Active Directory Domain
If you’re running PsExec on an Active Directory domain-joined computer and you’d like to blast out a command execution on all computers in that domain, use a wildcard.
PsExec will search your entire Active Directory domain and attempt to run a command on every computer. Below is example syntax on how PsExec will attempt to connect to every computer on the domain the executing computer is a part of and run the
hostname
command.Note that if you use an asterisk to find all computers in a domain while the local computer is part of a workgroup, you will receive the error
A system error has occurred: 6118
.Free mobile music downloads mp3 juice. Napster is great for MP3 music download on Android, the downside is, it is not free, but it comes with a one month free subscription which is restricted in some countries. It however has amazing features you can try for the free one month trial. Napster is simple to use with nicely categorized songs.
Using a wildcard forces PsExec to essentially run the command
net view /all
to first find all computers in the domain. This is an outdated way to find computer information due to its dependency on NetBIOS.Reading from a File
Another way you can run commands on multiple computers at once is to use a text file. Using the syntax
@<filename.txt>
, PsExec will read every line in the text file as if it were a computer name. It will then process each computer individually.Below you can see an example of using PowerShell to create a text file of line-delimited computer names and using that as input for psexec.
Copying local programs to the remote computer
Using the
-c
switch, psexec will copy any local program to the remote computer prior to execution.Perhaps you have an EXE on your local computer in a C:Tools folder and would like to run it on a remote computer. You can do so using the following syntax:
When you use the
-c
switch and don’t specify an executable file, PsExec will still copy the file but you’ll receive an error stating system cannot find the file specified. This happens because PsExec will always attempt to run the file you copy.If you need to copy files to remote computers prior to using PsExec, use the
Copy-Item
PowerShell cmdlet instead.Running Remote Processes under Alternate Credentials
Another popular use case of PsExec is to run commands under alternative accounts. By default, PsExec will attempt to connect to the remote computer under your currently-logged-in account. More specifically, it will impersonate Pes 2017 full version download. your account on the remote computer.
Using the
-u
and optional -p
switch allows you to connect to the remote computer with an alternative user account. PsExec will then encrypt both the username and password and send them to the remote computer for authentication.For example, if you’re in a workgroup, you’ll always need to specify the username to authenticate to the remote computer as.
If both computers are a member of Active Directory, be sure to preface the user account with the domain name.
Note that when you do not use the
-u
switch, psexec impersonates your logged-in account on the remote computer. It will not have access to any network resources.Running Processes as the LOCAL SYSTEM Account
One of the most useful features of running PsExec under an alternative account is using the
-s
switch. This switch allows PsExec (and your remotely-executed application) to run under the remote (or local) computer’s LOCAL SYSTEM account.Notice below I didn’t include a remote computer name. PsExec will just as gladly run on the local computer as well. In this instance, I’m using the
-s
option to tell PsExec to launch a local command prompt as the LOCAL SYSTEM account.To run a command prompt as LOCAL SYSTEM on a remote computer, add the computer name to the reference like below:
Launching GUI Applications Remotely
Another useful PsExec switch is
-i
. By default, PsExec does not allow the remotely-executed command to bring up any windows on the remote computer. This is helpful because if you’re executing commands remotely, you’re not going to see the screen anyway.But perhaps you need to bring up programs for your users. You personally won’t be using the application but an end-user will. In that case, use the
-i
switch.Maybe you need to bring up a notepad window on a remote computer. Not a problem. Run notepad.exe with the
-i
switch and PsExec will open up Notepad.Be sure to also use the
-d
switch to disconnect when the interactive window is brought up though. By default, PsExec will wait for the process it executed to complete. If the remote process (Notepad in this case) is kept running, PsExec will never return control.Using the
-d
switch with -i
will tell PsExec to not wait for the remote process to finish. Instead, it will disconnect and return control to you as soon as the remote process is executed.Redirecting Output
Powershell Install Exe Remotely
Psexec will rely any output sent from the remote process to your local session. Typically, this output will go directly to your local console. But if you’d like to redirect it, you can do so using typical redirection operators.
For example, if you’d like to run a command and silence all output, you could redirect output and errors to null using
^> nul ^2^&1
.Note the special characters are escaped with a hat. (
^
).PsExec Use Cases
Once you’ve learned how to use psexec, you’ll inevitably come across various specific use cases. In this section, you’ll learn some real-world use cases and examples using psexec.
Powershell Command To Uninstall Exe
Launching a Remote Command Prompt (psexec cmd
)
One of the most common use cases is launching PsExec as an interactive command prompt. PsExec doesn’t just run commands remotely. It can also send command output back to your console. Because of this, it can make a great telnet (if anyone is still using that) or perhaps PowerShell
Enter-PSSession
replacement.To launch a remote command, specify the remote computer name and run the cmd application. Cmd is the Windows command interpreter. Since PsExec supports interactive use, it will gladly return a flashing cursor and a prompt.
At this point, the world is your oyster. You can run commands on your local computer via this “nested” command prompt and they will be executed on the remote computer.
To exit from the command prompt, type
exit
. PsExec will stop the cmd
process on the remote computer and return focus to the local computer.Do NOT use Ctrl-C to close out of an interactive cmd session. Always use
exit
. If you use Ctrl-C, the psexec session will remain running on the remote computer.Installing Software Remotely
You can use PsExec as a poor-man’s software deployment tool. Perhaps you have an MSI installer that you need to run on one or more remote computers called setup.msi. This installer needs to be copied to the remote computers and then executed with the msiexec.exe utility with a few switches.
Below is an example of how you could use PsExec to remotely deploy software. This example copies setup.msi to the remote computer then launches the MSI installer interactively on as the SYSTEM account.
Accepting the EULA without the /accepteula
switch
As mentioned earlier, the first time PsExec runs, you’ll have to accept a EULA. You could use the
/accepteula
switch but you could also “stage” it in the registry.When launched for the first time, PsExec creates a registry key at HKCUSoftwareSysinternalsPsExec. Instead of that registry key, it creates a registry value called EulaAccepted with a DWORD value of 1.
Using your favorite method to modify the registry on remote computers, you simply need to create this key/value on computers you’d like to run PsExec on. Once created, no need to run
/accepteula
!Marrying PowerShell and PsExec
Before PowerShell, all we had was PsExec. Now, we have options. PowerShell can replace PsExec in many situations but complement it in others.
Building Computer Names with PowerShell
Instead of using
*
to find all computers in the domain, you can use PowerShell instead. By using PowerShell, you can not only pick certain computers but you don’t have to use the firewall-prone net view /all
behavior.You can use PowerShell to create a string containing all computer names separated by a comma. You can then pass that string to PsExec which will merrily process each one like you typed each one manually.
You can see below an example of using the
Get-AdComputer
cmdlet part of the ActiveDirectoryPowerShell module.Enabling PowerShell Remoting Remotely
If you have remote computers you’d rather use PowerShell Remoting with instead of PsExec, you can use PsExec to enable them.
By running
Enable-PSRemoting
or the winrm.cmd batch file on remote computers, you can quickly turn on PowerShell Remoting across many computers at once.Below you can see an example of calling the winrm.cmd batch file on a remote computer running as the SYSTEM account. Because the output from that command isn’t needed, it’s silenced with
2>&1> $null
.PsExec Error Messages
It’s worth mentioning again upfront that most error codes you see returned from PsExec are from the remote process; not from PsExec. But it’s helpful to have an understanding of these error codes and what they might mean.
If you’d like a reference on all Windows error codes, I recommend checking out this exhaustive list of Windows error codes.
Below is a list of common error codes you may see returned by PsExec.
Your Feedback
ATA Ultimate Guides are big. There’s a lot of information in these and I’m bound to miss a thing here or there or make a mistake. If you notice anything wrong or think something should be added to this guide, please let me know via the comments. I’d be happy to credit you in the post.
Credits
- Thanks to Mathias (comments) for numerous feedback.
When you install Visual Studio from a command prompt, you can use a variety of command-line parameters to control or customize the installation. From the command line, you can perform the following actions:
- Start the install with certain options preselected.
- Automate the installation process.
- Create a cache (layout) of the installation files for later use.
The command-line options are used in conjunction with the setup bootstrapper, which is the small (1 MB) file that initiates the download process. The bootstrapper is the first executable that is launched when you download from the Visual Studio site.
To get a bootstrapper for Visual Studio 2017, see the Visual Studio previous versions download page for details on how to do so.
Use the following links to get a direct link to the latest release bootstrapper for the product edition that you're installing:
Your bootstrapper file should match or be similar to one of the following file names:
- vs_enterprise.exe
- vs_professional.exe
- vs_community.exe
Tip
If you previously downloaded a bootstrapper file and want to verify its version, here's how. In Windows, open File Explorer, right-click the bootstrapper file, choose Properties, choose the Details tab, and then view the Product version number. To match that number to a release of Visual Studio, see the Visual Studio build numbers and release dates page.
Command-line parameters
Visual Studio command-line parameters are case-insensitive.
Syntax:
vs_enterprise.exe [command] <options>..
Replace
vs_enterprise.exe
as appropriate for the product edition you're installing. (Alternatively, you can use vs_installer.exe
.)Tip
For more examples of how to use the command line to install Visual Studio, see the Command-line parameter examples page.
Command | Description |
---|---|
(blank) | Installs the product. |
modify | Modifies an installed product. |
update | Updates an installed product. |
repair | Repairs an installed product. |
uninstall | Uninstalls an installed product. |
export | New in version 15.9: Exports installation selection to an installation configuration file. Note: Can only be used with vs_installer.exe. |
Command | Description |
---|---|
(blank) | Installs the product. |
modify | Modifies an installed product. |
update | Updates an installed product. |
repair | Repairs an installed product. |
uninstall | Uninstalls an installed product. |
export | Exports installation selection to an installation configuration file. Note: Can only be used with vs_installer.exe. |
Install options
Install option | Description |
---|---|
--installPath <dir> | The installation directory for the instance to act upon. For the install command, this is Optional and is where the instance will be installed. For other commands, this is Required and is where the previously installed instance was installed. |
--addProductLang <language-locale> | Optional: During an install or modify operation, this determines the UI language packs that are installed to the product. It can appear multiple times on the command line to add multiple language packs. If not present, the installation uses the machine locale. For more information, see the List of language locales section on this page. |
--removeProductLang <language-locale> | Optional: During an install or modify operation, this determines the UI language packs that are to be removed from the product. It can appear multiple times on the command line to add multiple language packs. For more information, see the List of language locales section on this page. |
--add <one or more workload or component IDs> | Optional: One or more workload or component IDs to add. The required components of the artifact are installed, but not the recommended or optional components. You can control additional components globally using --includeRecommended and/or --includeOptional . To include multiple workloads or components, repeat the --add command (for example, --add Workload1 --add Workload2 ). For finer-grained control, you can append ;includeRecommended or ;includeOptional to the ID (for example, --add Workload1;includeRecommended or --add Workload2;includeRecommended;includeOptional ). For more information, see the Workload and component IDs page. You can repeat this option as necessary. |
--remove <one or more workload or component IDs> | Optional: One or more workload or component IDs to remove. For more information, see our Workload and component IDs page. You can repeat this option as necessary. |
--in <path> | Optional: The URI or path to a response file. |
--all | Optional: Whether to install all workloads and components for a product. |
--allWorkloads | Optional: Installs all workloads and components, no recommended or optional components. |
--includeRecommended | Optional: Includes the recommended components for any workloads that are installed, but not the optional components. The workloads are specified either with --allWorkloads or --add . |
--includeOptional | Optional: Includes the optional components for any workloads that are installed, but not the recommended components. The workloads are specified either with --allWorkloads or --add . |
--quiet, -q | Optional: Don't display any user interface while performing the installation. |
--passive, -p | Optional: Display the user interface, but don't request any interaction from the user. |
--norestart | Optional: If present, commands with --passive or --quiet won't automatically restart the machine (if necessary). This is ignored if neither --passive nor --quiet are specified. |
--nickname <name> | Optional: This defines the nickname to assign to an installed product. The nickname can't be longer than 10 characters. |
--productKey | Optional: This defines the product key to use for an installed product. It's composed of 25 alphanumeric characters either in the format xxxxx-xxxxx-xxxxx-xxxxx-xxxxx or xxxxxxxxxxxxxxxxxxxxxxxxx . |
--help, --?, -h, -? | Display an offline version of this page. |
--config <path> | Optional and New in 15.9: During an install or modify operation, this determines the workloads and components to add based on a previously saved installation configuration file. This operation is additive and it won't remove any workload or component if they aren't present in the file. Also, items that don't apply to the product won't be added. During an export operation, this determines the location to save the installation configuration file. |
Install option | Description |
---|---|
--installPath <dir> | The installation directory for the instance to act upon. For the install command, this is Optional and is where the instance will be installed. For other commands, this is Required and is where the previously installed instance was installed. |
--addProductLang <language-locale> | Optional: During an install or modify operation, this determines the UI language packs that are installed to the product. It can appear multiple times on the command line to add multiple language packs. If not present, the installation uses the machine locale. For more information, see the List of language locales section on this page. |
--removeProductLang <language-locale> | Optional: During an install or modify operation, this determines the UI language packs that are to be removed from the product. It can appear multiple times on the command line to add multiple language packs. For more information, see the List of language locales section on this page. |
--add <one or more workload or component IDs> | Optional: One or more workload or component IDs to add. The required components of the artifact are installed, but not the recommended or optional components. You can control additional components globally using --includeRecommended and/or --includeOptional . To include multiple workloads or components, repeat the --add command (for example, --add Workload1 --add Workload2 ). For finer-grained control, you can append ;includeRecommended or ;includeOptional to the ID (for example, --add Workload1;includeRecommended or --add Workload2;includeRecommended;includeOptional ). For more information, see the Workload and component IDs page. You can repeat this option as necessary. |
--remove <one or more workload or component IDs> | Optional: One or more workload or component IDs to remove. For more information, see our Workload and component IDs page. You can repeat this option as necessary. |
--in <path> | Optional: The URI or path to a response file. |
--all | Optional: Whether to install all workloads and components for a product. |
--allWorkloads | Optional: Installs all workloads and components, no recommended or optional components. |
--includeRecommended | Optional: Includes the recommended components for any workloads that are installed, but not the optional components. The workloads are specified either with --allWorkloads or --add . |
--includeOptional | Optional: Includes the optional components for any workloads that are installed, but not the recommended components. The workloads are specified either with --allWorkloads or --add . |
--quiet, -q | Optional: Don't display any user interface while performing the installation. |
--passive, -p | Optional: Display the user interface, but don't request any interaction from the user. |
--norestart | Optional: If present, commands with --passive or --quiet won't automatically restart the machine (if necessary). This is ignored if neither --passive nor --quiet are specified. |
--nickname <name> | Optional: This defines the nickname to assign to an installed product. The nickname can't be longer than 10 characters. |
--productKey | Optional: This defines the product key to use for an installed product. It's composed of 25 alphanumeric characters either in the format xxxxx-xxxxx-xxxxx-xxxxx-xxxxx or xxxxxxxxxxxxxxxxxxxxxxxxx . |
--help, --?, -h, -? | Display an offline version of this page. |
--config <path> | Optional: During an install or modify operation, this determines the workloads and components to add based on a previously saved installation configuration file. This operation is additive and it won't remove any workload or component if they aren't present in the file. Also, items that don't apply to the product won't be added. During an export operation, this determines the location to save the installation configuration file. |
Important
When specifying multiple workloads and components, you must repeat the
--add
or --remove
command-line switch for each item.Layout options
Layout options | Description |
---|---|
--layout <dir> | Specifies a directory to create an offline install cache. For more information, see Create a network-based installation of Visual Studio. |
--lang <one or more language-locales> | Optional: Used with --layout to prepare an offline install cache with resource packages with the specified language(s). For more information, see the List of language locales section on this page. |
--add <one or more workload or component IDs> | Optional: One or more workload or component IDs to add. The required components of the artifact are installed, but not the recommended or optional components. You can control additional components globally using --includeRecommended and/or --includeOptional . For finer-grained control, you can append ;includeRecommended or ;includeOptional to the ID (for example, --add Workload1;includeRecommended or --add Workload2;includeOptional ). For more information, see the Workload and component IDs page. Note: If --add is used, only the specified workloads and components and their dependencies are downloaded. If --add isn't specified, all workloads and components are downloaded to the layout. |
--includeRecommended | Optional: Includes the recommended components for any workloads that are installed, but not the optional components. The workloads are specified either with --allWorkloads or --add . |
--includeOptional | Optional: Includes the recommended and optional components for any workloads being included in the layout. The workloads are specified with --add . |
--keepLayoutVersion | New in 15.3, optional: Apply changes to the layout without updating the version of the layout. |
--verify | New in 15.3, optional: Verify the contents of a layout. Any corrupt or missing files are listed. |
--fix | New in 15.3, optional: Verify the contents of a layout. If any files are corrupt or missing, they're redownloaded. Internet access is required to fix a layout. |
--clean <one or more paths to catalogs> | New in 15.3, optional: Removes old versions of components from a layout that has been updated to a newer version. |
Advanced install options | Description |
---|---|
--channelId <id> | Optional: The ID of the channel for the instance to be installed. This is required for the install command, and ignored for other commands if --installPath is specified. |
--channelUri <uri> | Optional: The URI of the channel manifest. If updates aren't wanted, --channelUri can point to a non-existent file (for example, --channelUri C:doesntExist.chman). This can be used for the install command; it's ignored for other commands. |
--installChannelUri <uri> | Optional: The URI of the channel manifest to use for the installation. The URI specified by --channelUri (which must be specified when --installChannelUri is specified) is used to detect updates. This can be used for the install command; it's ignored for other commands. |
--installCatalogUri <uri> | Optional: The URI of the catalog manifest to use for the installation. If specified, the channel manager attempts to download the catalog manifest from this URI before using the URI in the install channel manifest. This parameter is used to support offline install, where the layout cache will be created with the product catalog already downloaded. This can be used for the install command; it's ignored for other commands. |
--productId <id> | Optional The ID of the product for the instance that will be installed. This is pre-populated in normal installation conditions. |
--wait | Optional: The process will wait until the install is completed before returning an exit code. This is useful when automating installations where one needs to wait for the install to finish to handle the return code from that install. |
--locale <language-locale> | Optional: Change the display language of the user interface for the installer itself. Setting will be persisted. For more information, see the List of language locales section on this page. |
--cache | New in 15.2, optional: If present, packages will be kept after being installed for subsequent repairs. This overrides the global policy setting to be used for subsequent installs, repairs, or modifications. The default policy is to cache packages. This is ignored for the uninstall command. Read how to disable or move the package cache for more information. |
--nocache | New in 15.2, optional: If present, packages will be deleted after being installed or repaired. They'll be downloaded again only if needed and deleted again after use. This overrides the global policy setting to be used for subsequent installs, repairs, or modifications. The default policy is to cache packages. This is ignored for the uninstall command. Read how to disable or move the package cache for more information. |
--noUpdateInstaller | New in 15.2, optional: If present, prevents the installer from updating itself when quiet is specified. The installer will fail the command and return a non-zero exit code if noUpdateInstaller is specified with quiet when an installer update is required. |
--noWeb | New in 15.3, optional: If present, Visual Studio setup uses the files in your layout directory to install Visual Studio. If a user tries to install components that aren't in the layout, setup fails. For more information, see Deploying from a network installation. Important: This switch doesn't stop Visual Studio setup from checking for updates. For more information, see Control updates to network-based Visual Studio deployments. |
--path <name>=<path> | New in 15.7, optional: Used to specify custom install paths for the installation. Supported path names are shared, cache, and install. |
--path cache=<path> | New in 15.7, optional: Uses the location you specify to download installation files. This location can only be set the first time that Visual Studio is installed. Example: --path cache='C:VScache' |
--path shared=<path> | New in 15.7, optional: Contains shared files for side-by-side Visual Studio installations. Some tools and SDKs install to a location on this drive, while some others might override this setting and install to another drive. Example: --path shared='C:VSshared' Important: This can be set only once and on the first time that Visual Studio is installed. |
--path install=<path> | New in 15.7, optional: Equivalent to –-installPath . Specifically, --installPath 'C:VS' and --path install='C:VS' are equivalent. Only one of these commands can be used at a time. |
Layout options | Description |
---|---|
--layout <dir> | Specifies a directory to create an offline install cache. For more information, see Create a network-based installation of Visual Studio. |
--lang <one or more language-locales> | Optional: Used with --layout to prepare an offline install cache with resource packages with the specified language(s). For more information, see the List of language locales section on this page. |
--add <one or more workload or component IDs> | Optional: One or more workload or component IDs to add. The required components of the artifact are installed, but not the recommended or optional components. You can control additional components globally using --includeRecommended and/or --includeOptional . For finer-grained control, you can append ;includeRecommended or ;includeOptional to the ID (for example, --add Workload1;includeRecommended or --add Workload2;includeOptional ). For more information, see the Workload and component IDs page. Note: If --add is used, only the specified workloads and components and their dependencies are downloaded. If --add isn't specified, all workloads and components are downloaded to the layout. |
--includeRecommended | Optional: Includes the recommended components for any workloads that are installed, but not the optional components. The workloads are specified either with --allWorkloads or --add . |
--includeOptional | Optional: Includes the recommended and optional components for any workloads being included in the layout. The workloads are specified with --add . |
--keepLayoutVersion | Optional: Apply changes to the layout without updating the version of the layout. |
--verify | Optional: Verify the contents of a layout. Any corrupt or missing files are listed. |
--fix | Optional: Verify the contents of a layout. If any files are corrupt or missing, they're redownloaded. Internet access is required to fix a layout. |
--clean <one or more paths to catalogs> | Optional: Removes old versions of components from a layout that has been updated to a newer version. |
Advanced install options | Description |
---|---|
--channelId <id> | Optional: The ID of the channel for the instance to be installed. This is required for the install command, and ignored for other commands if --installPath is specified. |
--channelUri <uri> | Optional: The URI of the channel manifest. If updates aren't wanted, --channelUri can point to a non-existent file (for example, --channelUri C:doesntExist.chman). This can be used for the install command; it's ignored for other commands. |
--installChannelUri <uri> | Optional: The URI of the channel manifest to use for the installation. The URI specified by --channelUri (which must be specified when --installChannelUri is specified) is used to detect updates. This can be used for the install command; it's ignored for other commands. |
--installCatalogUri <uri> | Optional: The URI of the catalog manifest to use for the installation. If specified, the channel manager attempts to download the catalog manifest from this URI before using the URI in the install channel manifest. This parameter is used to support offline install, where the layout cache will be created with the product catalog already downloaded. This can be used for the install command; it's ignored for other commands. |
--productId <id> | Optional The ID of the product for the instance that will be installed. This is pre-populated in normal installation conditions. |
--wait | Optional: The process will wait until the install is completed before returning an exit code. This is useful when automating installations where one needs to wait for the install to finish to handle the return code from that install. |
--locale <language-locale> | Optional: Change the display language of the user interface for the installer itself. Setting will be persisted. For more information, see the List of language locales section on this page. |
--cache | Optional: If present, packages will be kept after being installed for subsequent repairs. This overrides the global policy setting to be used for subsequent installs, repairs, or modifications. The default policy is to cache packages. This is ignored for the uninstall command. Read how to disable or move the package cache for more information. |
--nocache | Optional: If present, packages will be deleted after being installed or repaired. They'll be downloaded again only if needed and deleted again after use. This overrides the global policy setting to be used for subsequent installs, repairs, or modifications. The default policy is to cache packages. This is ignored for the uninstall command. Read how to disable or move the package cache for more information. |
--noUpdateInstaller | Optional: If present, prevents the installer from updating itself when quiet is specified. The installer will fail the command and return a non-zero exit code if noUpdateInstaller is specified with quiet when an installer update is required. |
--noWeb | Optional: If present, Visual Studio setup uses the files in your layout directory to install Visual Studio. If a user tries to install components that aren't in the layout, setup fails. For more information, see Deploying from a network installation. Important: This switch doesn't stop Visual Studio setup from checking for updates. For more information, see Control updates to network-based Visual Studio deployments. New in 16.3.5: This switch prevents errors and improves performance with offline installs and updates. |
--path <name>=<path> | Optional: Used to specify custom install paths for the installation. Supported path names are shared, cache, and install. |
--path cache=<path> | Optional: Uses the location you specify to download installation files. This location can only be set the first time that Visual Studio is installed. Example: --path cache='C:VScache' |
--path shared=<path> | Optional: Contains shared files for side-by-side Visual Studio installations. Some tools and SDKs install to a location on this drive, while some others might override this setting and install to another drive. Example: --path shared='C:VSshared' Important: This can be set only once and on the first time that Visual Studio is installed. |
--path install=<path> | Optional: Equivalent to –-installPath . Specifically, --installPath 'C:VS' and --path install='C:VS' are equivalent. Only one of these commands can be used at a time. |
List of workload IDs and component IDs
For a list of workload and component IDs sorted by Visual Studio product, see the Visual Studio workload and component IDs page.
List of language locales
Language-locale | Language |
---|---|
Cs-cz | Czech |
De-de | German |
En-us | English |
Es-es | Spanish |
Fr-fr | French |
It-it | Italian |
Ja-jp | Japanese |
Ko-kr | Korean |
Pl-pl | Polish |
Pt-br | Portuguese - Brazil |
Ru-ru | Russian |
Tr-tr | Turkish |
Zh-cn | Chinese - Simplified |
Zh-tw | Chinese - Traditional |
Error codes
Depending on the result of the operation, the
%ERRORLEVEL%
environment variable is set to one of the following values:Value | Result |
---|---|
0 | Operation completed successfully |
1602 | Operation was canceled |
1641 | Operation completed successfully, and reboot was initiated |
3010 | Operation completed successfully, but install requires reboot before it can be used |
5003 | Bootstrapper failed to download installer |
5004 | Operation was canceled |
5005 | Bootstrapper command-line parse error |
5007 | Operation was blocked - the computer does not meet the requirements |
-1073741510 | Microsoft Visual Studio Installer was terminated (by the user or external process) |
Other (for example: -1, 1, 1603) | Failure condition occurred - check the logs for more information |
Each operation generates several log files in the
%TEMP%
directory that indicate the progress of the installation. Sort the folder by date and look for files that begin with dd_bootstrapper
, dd_client
, and dd_setup
for the bootstrapper, the installer app, and the setup engine, respectively.Get support
Sometimes, things can go wrong. If your Visual Studio installation fails, see Troubleshoot Visual Studio installation and upgrade issues for step-by-step guidance.
We also offer an installation 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.