fb
Homepage 5 How-to Articles 5 How to Use WMIC to Install Software Remotely

How to Use WMIC to Install Software Remotely

Manage remote endpoints, deploy software and patches with Action1 cloud RMM solution.

Sign up and use free on up to 50 endpoints with no functionality limits or expiration.



January 18, 2019

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 to avoid clear-text typing the password(who looks over his shoulder;)). We will execute the runas command as follows:

runas /user:[email protected] 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 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;
}

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.

Related Articles

How To Delete User Profiles Remotely with PowerShell

When a user logs onto the computer for the first time (not via the network to access shared folders or printers), Windows creates a user profile. Among its contents are the NTUSER.DAT file (user profile settings), user-specific folders (My Documents, Desktop, etc.),...

About Action1 RMM

Action1 RMM is a cloud-based IT solution for remote monitoring and management, patching, and remote support.

Start your free two-week trial of Action1, or use RMM tools for free forever on 50 endpoints with no functionality limitations!



0 Comments

Submit a Comment

Your email address will not be published.

cloud patch management solutions action1

MSP Solution

Centralize endpoint management and boost efficiency of IT service delivery.

automated server patch management action compliance

Patch Management

Identify and deploy missing OS and third-party software updates.

cloud software deployment tools windows

Software Deployment

Distribute software and updates across managed endpoints.

software distribution tools software inventory action1

IT Asset Inventory

Keep a detailed inventory and manage hardware and software assets.

web client remote desktop

Remote Desktop

Support users via seamless remote desktop connection.

web based rdp client

Unattended Access

Provide administrative support and manage remote devices.

automated patch management action1

Endpoint Management

Run PowerShell, custom scripts, reboot computers and restart services.

API integrations action1

RESTful API

Integrate Action1 RMM to your IT ecosystem.

computer inventory tool for compliance

Reports and Alerts

Conduct endpoint security audits with comprehensive reporting.