NEW ACTION1 PLATFORM: NOW WITH MACOS SUPPORT

This Wednesday | 12 PM EST / 11 AM CET

Action1 5 How-to Articles 5 How to Use WMIC to Install Software Remotely

How to Use WMIC to Install Software Remotely

January 18, 2019

By Peter Barnett

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. List of WMI Software Components

WMI tools are installed by default and include the following components:

  • Wmimgmt.msc is an MMC snap-in that allows you to manage the WMI system on a selected computer.
  • Winmgmt.exe is a WMI management console tool. Performs similar actions as the MMC wmimgmt.msc console. In addition, Windows 2000 is an executable WMI service file on the system. To start from the console it is used with the /exe option (winmgmt.exe /exe). Starting with Windows XP, the WMI executable is the wmisvc.dll library, which is loaded using the svchost.exe host controller (Generic Host Process for Win32 Services). In Windows 7-10, winmgmt.exe allows you to configure the WMI service for both the SVChost group under the name netsvcs and for a separate group called Winmgmt. In Windows 10, the grouping of services launched using svchost.exe is practically not used most services have their own svchost.exe process.
  • Wbemtest.exe is a graphical utility for interactive work with WMI. Convenient for testing classes and methods, viewing properties, etc.
  • Wmic.exe a console utility for calling WMI objects and methods (WMI Console) is present only in Windows XP and later versions of Windows.
  • Mofcomp.exe is a compiler of MOF files. It is used to expand the WMI repository and fine operations with the WMI class library, as well as to detect and fix repository data errors.

The main WMI data directory for a standard Windows installation is C: \ Windows \ System32 \ wbem.

install software remotely using wmic

2. Various Modes of Starting WMIC

WMIC can be used both interactively and in batch mode. Interactive mode is convenient when the operator enters a sequence of WMIC commands, working directly at the computer. Batch mode is designed to run WMIC from a batch file or is used when one command is required.

Interactive mode

To start WMIC interactively, in the Start – Run window or at the command line, enter:

wmic

A prompt appears:

wmic:root\cli>

(root \ cli default WMIC role).

At the prompt, you can enter an alias, command or switch, as well as the /? to display reference information.

To exit interactive mode, you can use the Exit or Quit command.

install software remotely with wmic

Batch mode

To get information about using WMIC in batch mode, type:

wmic /?

Key /? provides help output (in this case, control will be returned to the command line of the operating system). In batch mode, as well as in interactive mode, you can use aliases, switches, and commands.

3. 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 avoiding 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.

install software remotely with wmic

4. 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).

5. 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 installation call like the following:

> /node:exampleremotemachine product call install true,“” , “c:\PathToYour\File.msi”

If we do not enter a 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;
}

6. 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.

Consider Using Action1 to Deploy Software Remotely if:

  • You need to perform an action on multiple computers simultaneously.
  • You have remote employees with computers not connected to your corporate network.

Action1 is a cloud-based platform for patch management, software deployment, remote desktop, IT asset management, endpoint management and endpoint configuration reporting.

See What You Can Do with Action1

 

Join our weekly LIVE demo “Patch Management That Just Works with Action1” to learn more

about Action1 features and use cases for your IT needs.

 

spiceworks logo
getapp logo review
software advice review
trustradius
g2 review
spiceworks logo

Related Posts