HOWTO: Install software remotely using wmic

WMIC (Windows Management Instrumentation Command-Line) is a potent tool that often doesn’t see much use due to the lack of (easily accessible) documentation available. We’ll be using WMIC with domain admin credentials to crawl through a list of nodes (PCs/Laptops) and install software remotely without interrupting the user.
Though there are a couple advanced ways to accomplish this task, we’ll be examining the most straightforward method: an MSI installation file requiring no options located on each remote user’s local drive.

1. Load up a command shell with appropriate access permissions:

   - Though a WMIC instruction can be given appropriate credentials prior to operation, it is typically best-practice to avoid clear-text typing the password (who is that looking over your shoulder;)). We’ll execute the runas command like the following:
Runas /user:DomainAdminAccount@DOMAIN cmd
… which will prompt us for the credentials of our DomainAdminAccount. If authenticated, we’ll be handed a command shell running as the Admin.

2. Step into WMIC:

   - One of the nice features of WMIC is that it may be run from any machine. With our admin command shell, we’re going to enter the wmic command followed by enter.
(Note: We could have jumped into WMIC directly from the runas command… this just breaks out the steps).

3. Call the installation (for a single machine):

   - WMIC’s install call allows compatible WMI applications to be installed with no interaction from the user (they see nothing, the program is simply installed according to the default installation parameters you or the product packager have specified).
Here’s the rub: individual MSI packages will have different "options" (the second input required in the install call as shown in the attached screenshot). To simplify our example, we’re installing from an MSI that requires no options.
We’ll enter the install call like the following:
> /node:exampleremotemachine product call install true,"" , "c:\PathToYour\File.msi"
Which will prompt us for confirmation in the following format:
Execute (Win32_Product)->Install() (Y/N)?
To which we must answer yes (y) to confirm. If your WMI compliant MSI package was successfully installed, you should see something like the following:
Method execution successful.
Out Parameters:
instance of __PARAMETERS
ReturnValue = 0;

4. Call the installation (for a list of machines):

   - We’ll use WMIC’s ability to handle a flat text file as input for the nodes to run this installation on a list of machines (in our example, stored on the admin’s local hard drive in C:\computers.txt) by running the following command:
> /node::@"c:\computers.txt" product call install true,"" , "c:\PathToYour\File.msi
Which will iterate through the list in computers.txt… skipping over invalid nodes (eg: the machine is turned off), and asking for installation confirmation for each machine.

Also consider using Action1 to install software remotely if:
- You need to perform this action on multiple (hundreds or even thousands) computers simultaneously.
- Some of your endpoints are laptops not connected to corporate network at all times.

Action1 is a cloud-based platform for software deployment, software/hardware inventory, patch management, endpoint configuration and more. It is free with basic functionality.

Other Relevant HOWTOs: