Windows - wmic cpu get LoadPercentage always returns empty value
By Ethan Wilansky

Microsoft is creating a lot of good reasons to make the command prompt in Windows XP and the Windows Server 2003 family your home for systems management. Windows Management Instrumentation Command-line (WMIC), which uses the power of Windows Management Instrumentation (WMI) to enable systems management from the command line, is one of those reasons.

WMI has been an important part of Microsoft's systems management initiative since Microsoft Systems Management Server (SMS) 2.0 and has grown in popularity since the introduction of Windows 2000. However, until the introduction of WMIC, you couldn't easily access the WMI repository or the WMI namespace from a command prompt.

What Is WMIC?

WMIC extends WMI for operation from several command-line interfaces and through batch scripts. Before WMIC, you used WMI-based applications (such as SMS), the WMI Scripting API, or tools such as CIM Studio to manage WMI-enabled computers. Without a firm grasp on a programming language such as C++ or a scripting language such as VBScript and a basic understanding of the WMI namespace, do-it-yourself systems management with WMI was difficult. WMIC changes this situation by giving you a powerful, user-friendly interface to the WMI namespace.

WMIC is more intuitive than WMI, in large part because of aliases. Aliases take simple commands that you enter at the command line, then act upon the WMI namespace in a predefined way, such as constructing a complex WMI Query Language (WQL) command from a simple WMIC alias Get command. Thus, aliases act as friendly syntax intermediaries between you and the namespace. For example, when you run a simple WMIC command such as

useraccount list brief

from the WMIC command prompt to get user account information, the Useraccount alias performs a WQL query of the Win32_Useraccount class and displays specific data from this class in text format. WMIC also displays the Win32_Useraccount class's properties at the console in text format. WMIC can return the results of a command in other formats, such as XML, HTML, and Comma Separated Value (CSV).

WMIC stores aliases as instances of a class in the WMI schema. The default alias classMSFT_CliAlias—and other classes that support WMIC are stored in the schema's default namespace, or role—root\cli. Think of a role as simply another WMI namespace that's specifically designed to support WMIC. The default role, root\cli, connects to the root\cimv2 namespace to operate on the classes within root\cimv2. You won't typically use CIM Studio when you run WMIC, but you can use CIM Studio to find the root\cli namespace in a list of WMI namespaces. Figure 1 shows the root\cli node and some of the properties in the MSFT_CliAlias class.

Figure 1: The root\cli namespace and MSFT_CliAlias

You can add new aliases to the root\cli namespace and to other namespaces. You can also access the WMI namespace directly with the Class and Path commands. Later in this article, I show you how to use these commands.

How to Run WMIC

To invoke the WMIC command prompt, type


in the standard XP or .NET Server command interpreter (cmd.exe), a Telnet session, or the Run dialog box. These startup methods are available locally or through a .NET Server Terminal Services session.

The first time you start WMIC, Windows installs it on the computer and displays the WMIC command prompt, wmic:root\cli>. At this prompt, you enter commands interactively. For example, the command

process where name='outlook.exe' call terminate

closes Microsoft Outlook if it's running. After the command runs, the WMIC command prompt reappears. Note that you must type each command in this article on one line, not split across multiple lines, for the commands to run properly. (Some commands in the tables and listings in this article are split across multiple lines for publication purposes.)

WMIC also runs in noninteractive mode. This mode is especially useful when you need to complete a single task or you need to run WMIC commands in a batch file. To run a command in noninteractive mode, you start WMIC and run the command in the same line of code. For example, you can open a command prompt and type

wmic /node:SERVER1 printer list status

to check the status of printers attached to SERVER1. In this example, WMIC starts, uses the /node switch to establish a remote connection to SERVER1, and runs a command to display printer status information. After the command runs and displays results, the command prompt reappears.

You can remotely access any WMI-enabled computer from any computer running WMIC. The computer you want to access doesn't require WMIC. For example, you can start WMIC from a computer running XP Professional Edition to manage a mix of computers running XP, Win2K, Windows NT 4.0, Windows Me, and Windows 9x.

WMIC Command-Line Components

WMIC uses global switches, aliases, verbs, commands, and command-line help to empower the interface. Global switches are settings that apply to and for the entire WMIC session. For example, the /trace:on switch enables error tracing. While this switch is on, WMIC returns error information for every command you execute. The /node switch lets you access a remote computer. The /interactive:on switch ensures that WMIC prompts you for confirmation before performing delete operations. Other global switches include /role, /user, /implevel, and /namespace.

As I explained earlier, aliases are the friendly syntax intermediaries between you and the WMI namespace. Verbs are the actions you want to take when specifying an alias. I've already shown you the List and Call verbs. Table 1 describes the other WMIC verbs and provides a sample command for each one.

Table 1 WMIC Verbs


Sample Command



group where name= 'administrators' assoc

Shows all the associations that the Administrators group has with the system. For example, Administrators group members and the drives that they own appear in the list of properties displayed.

os assoc

Displays information about the OS and installed patches and hotfixes.


environment create name="progloc", username="wkst01\ ethanw", variablevalue= "%programfiles%\prog01"

Adds a variable named Progloc and sets its value to a folder below the Program Files folder. For example, the sample command is adding this variable to the Ethanw user account on the WKST01 workgroup computer.


environment where(name= "progloc") delete

Deletes the Progloc environment variable. To avoid unintended deletions when testing a WMIC command that uses the Delete verb, use the /interactive:on global switch. You'll then be prompted to confirm each deletion.


partition get bootpartition, description, deviceid, bootable

Returns the boot-partition Boolean (true or false), description string, and device ID properties of the partition alias.


path WIN32_USERACCOUNT where(name="user01") set disabled="true"

Disables the User01 user account on a member server or workstation.

FiftyThree FiftyThree 53PW06 Pencil Digital Stylus for iPad, iPad Pro, and iPhone - Walnut with Magnetic Snap
Boost (FiftyThree)
  • Connects to iPads 3+, iPad mini, iPad Pro, iPhone 4s and above.
  • Connects to Paper by FiftyThree, Microsoft OneNote, Procreate, Sketchbook Mobile, Note shelf, and others.
  • Surface Pressure: Pencil s unique tip is shaped to create lines of all sizes without any settings.
  • Erase: Pencil s builtin eraser lets you try anything knowing an eraser is only a flip away.
  • Blend: Use your finger to smooth rough edges and blend colors directly on the page.
  • Palm Rejection: Rest your hand on the screen and write from any angle. No calibration or setup.
  • What s included: Pencil, USB rechargeable battery, Extra Tip, Extra Eraser
  • Walnut model with Magnetic Snap (attaches to Apple iPad Smart Cases & Covers)
Plantar Fasciitis Compression Socks / Ankle Brace by 1st Elite- Pain Relief in Heels Foot Arch Achilles Tendon Support Night Splint Foot Sleeve for Women Men
Sports (1st Elite)
  • EFFECTIVE COMPRESSION -Combining truly effective graduated compression and an anatomically correct design we ve created a sleeve that is not only the perfect solution...
  • UNBEATABLE FIT -Our measurements are exact and as long as yours are too your feet will be in heaven. Wear them during your run or at night to help ease pain and...
  • DON T BE FOOLED -Don t find yourself buying a tight sock that does anything but what it says it ll do and quit wasting time with copper junk! It s time to invest...
  • TRUE COMFORT -Leave the bulk and sweatiness of neoprene behind and enjoy breathability and improved relief! Better still the low profile of our sock makes it perfect...
  • GUARANTEED -We offer complete customer satisfaction period. Our customers are always more important than our sales. If for any reason you are not absolutely happy...
Old World Razors Old World Razors – “Faux Black Horn” Classic DE Safety Razor & Feather Blade 5 Pack
Beauty (Old World Razors)
  • Chrome Plating - Helps to prevent rust and water spots
  • Screw Top Head - For easy razor replacement
  • Cost Effective - DE blades are much cheaper than their cartridge counterparts
  • Classic Design - Provides an aesthetic that stand the test of time
Shalleen Mini Coffee Stirrer AA Battery Electronic Milk Frother Mixer Whisk Cream Beater Shalleen Mini Coffee Stirrer AA Battery Electronic Milk Frother Mixer Whisk Cream Beater
Kitchen (Shalleen Mini Coffee Stirrer AA Battery Electronic Milk Frother Mixer Whisk Cream Beater)
  • Brand:unbranded
  • Description Feature: 100% Brand new and high quality Non-stick, flexible and easy to handle Stainless steel spring and the body is made of abs plastic Simple on/off...
  • Specifications: Material: ABS Plastic, stainless steel Power:2 AA Batteries. (NOT INCLUDED) Total length:2.5cm*3.7cm*20.5cm Stirring rod length:10cm Color: Pink
  • Package Content: 1x Egg Beater Milk Mixer Description Feature: 100% Brand new and high quality Non-stick, flexible and easy to handle Stainless steel spring and...
  • Specifications: Material: ABS Plastic, stainless steel Power:2 AA Batteries. (NOT INCLUDED) Total length:2.5cm*3.7cm*20.5cm Stirring rod length:10cm Color: Pink...
PET N PET PET N PET 48 Rolls/720 Counts Environmental Friendly Dog Poop Bags Unscented with One Dispenser
Pet Products (PET N PET)
  • 720 counts + 1 dispenser ( 48 rolls, 15 bags per roll )
  • 9*13 inches, easy to tie and carry
  • Heavy duty and never leak
  • Earth friendly - EPI technology, unscented and anti-bacterial
  • Unique teeth dispenser design, easy to tear off and detach from the roll

Related posts: