Before Windows PowerShell and all the flexibility (and complexity) that brings, there was WMIC, the command-line client for WMI.
WMIC works out of the box with Windows XP and later (including Server 2003 and Vista), and allows access to operations provided via WMI: “a powerful, user-friendly interface to the WMI namespace”. Upon first use, the WMIC environment is installed:
C:\> WMIC Please wait while WMIC is being installed...
Several tasks which normally feel very GUI-oriented, such as checking the battery status, are made very “command-line” with WMIC:
C:\> WMIC Path Win32_Battery Get BatteryStatus /Format:List BatteryStatus=1
In this case, the batter is discharging. You can see the beginnings of PowerShell in the syntax and detailed status/operations available. Another useful command is useraccount, to return details of the user accounts on the system:
C:\> WMIC useraccount list brief AccountType Caption Domain FullName Name SID 512 SKELTON-M\Administrator SKELTON-M Administrator S-1-5-21-68**03330-*********-839**2115-500 512 SKELTON-M\Guest SKELTON-M Guest S-1-5-21-68**03330-*********-839**2115-501 ...
Or how about terminating a specific process (notepad.exe) from the command-line? Here we go:
C:\> WMIC process where name='notepad.exe' call terminate Executing (\\SKELTON-M\ROOT\CIMV2:Win32_Process.Handle="4652")->terminate() Method execution successful. Out Parameters: instance of __PARAMETERS { ReturnValue = 0; };
It’s helpful to install the WMI Administative Tools, so you can explore the WMI namespace and investgate the operations available to you via WMIC. For example, to determine the name of the time zone currently used by the system, use the TimeZone path:
C:\> WMIC Path Win32_TimeZone Get StandardName /Format:List StandardName=GMT Standard Time
The time zone for my computer currently is “GMT Standard Time”.
For simple operations which do not merit PowerShell scripts or installation, WMIC is a good choice.