HOWTO: Use WMIC Remotely to Install Software on Windows OS Machines

WMI (Windows Management Instrumentation) is often used to manage Windows systems using different graphical utilities - an implementation of the object-oriented management standard WBEM. You can use wbemtest.exe as a GUI utility for working with WMI. To work with WMI from the console created wmic.exe. We will use WMIC remotely with domain administrator credentials to scan the list of nodes (PCs / laptops) and install software without interrupting user experience. Although there are several advanced ways to accomplish this task, we will consider the simplest method: the MSI installation file, which does not require options, is located on the local disk of each remote user.

1. Load up a Command Shell with Appropriate Access Permissions

    Although WMIC instructions can be provided with appropriate credentials before starting work, it is usually recommended to avoid clear-text typing the password(who looks over his shoulder;)). We will execute the runas command as follows:
runas /user:DomainAdminAccount@DOMAIN cmd
that will ask us for the credentials of our DomainAdminAccount. In the case of successful authentication, we will get a shell running on behalf of the administrator.

2. Step into WMIC Remotely to Install Software

    One of the nice advantages of WMIC is that it can work from any machine. With our admin shell, we're going to type wmic and then push Enter button. (Note: we could go to WMIC directly from the runas command ... it just breaks the steps).

3. Call the Installation (for a Single Machine)

    The main problem is that individual MSI packages will have different “options”. To simplify our example, we perform an installation with MSI, which does not require any options. We will enter the setup call as shown below. We’ll enter the install call like the following:
> /node:exampleremotemachine product call install true,"" , "c:\PathToYour\File.msi"
If we do not enter an wmic invalid node, we will be asked to confirm 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 will use the WMIC feature to process the flat text file as input to the nodes to perform this installation on the list of machines (in our example, stored on the local administrator’s hard disk 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.
Although there is an opinion about the rather scant wmic documentation, most of the users are sufficient instructions on the official Microsoft site to deploy software or to create wmic list installed software.

Also consider using Action1 to deploy 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: