WMIC (Windows Management Interface Command) commands

Ritesh Pawar
4 min readApr 4, 2020

--

You may have heard about WMIC while working with Windows operating system. If not, in this blog you will get to know about WMIC things that are required to work with windows management commands.

Open command prompt by using Search or Run option from start menu.

Type below command to get all the available options with WMIC:

wmic /?

WMIC: all the available options
Image 1: wmic available options

We will see some of the available options in this blog.

  1. COMPUTERSYSTEM — Computer system management.

This global switch provides information about your computer system like DNSHostName, Domain, Manufacturer, Model, Name, NumberOfLogicalProcessors, UserName etc.

But, how will you know what are the details this global switch provides. Don’t worry, use below command to get the all available details under this switch.

wmic COMPUTERSYSTEM

Image 2: Computer System global switch — get all available details

You can get specific details by querying as shown below:

wmic COMPUTERSYSTEM get DNSHostName, Manufacturer, Model, NumberOfLogicalProcessors

Image 3: Computer System global switch — get specific details

2. CPU — CPU management

Using this option you will get many details related to the system CPU like Manufacturer, MaxClockSpeed, Name, NumberOfCores, NumberOfLogicalProcessors, ProcessorId etc.

Use below command to get the all available details under this switch.

wmic CPU

Image 4: CPU global switch — get all available details

You can get specific details by querying as shown below:

wmic CPU get Name, NumberOfCores, ProcessorId

Image 5: CPU global switch — get specific details

3. LOGICALDISK — Local storage device management

You may find this option very useful if you are working with windows based logical disk drive management. This option provides many details like Caption, DriveType, FileSystem, FreeSpace, Size etc.

Use below command to get the all available details under this switch.

wmic LOGICALDISK

You can get specific details by querying as shown below:

wmic LOGICALDISK get Caption, DriveType, FileSystem, FreeSpace, Size

Image 6: LOGICALDISK global switch — get specific details

Even you can query using the where clause, interesting right? See below:

wmic LOGICALDISK where Caption=”C:” get Caption, DriveType, FileSystem, FreeSpace, Size

Image 7: LOGICALDISK global switch — using WHERE clause

4. NIC — Network Interface Controller (NIC) management

This global switch provides information about all the Network Interfaces available with the system. Let’s see how to get the information:

wmic NIC

Image 8: NIC global switch — get all available details

You can get specific details by querying as shown below:

wmic NIC get AdapterType, AdapterTypeId, MACAddress, NetEnabled

Image 9: NIC global switch — get specific details

Observe the empty lines in the above image after the header line. This is because we are getting all the available details with the system where some information is not available with network interfaces.

Let’s use WHERE clause to get only valid data:

wmic NIC where AdapterTypeId=0 get AdapterType, AdapterTypeId, MACAddress, NetEnabled

Image 10: NIC global switch —using WHERE clause

5. OS — Installed Operating System/s management

You may find this global switch very useful in case you want details about the windows operating system like OSArchitecture, FreePhysicalMemory, InstallDate, Manufacturer, NumberOfLicensedUsers, NumberOfProcesses, NumberOfUsers, SerialNumber, SystemDrive etc.

Let’s get all the available attributes with this global switch:

wmic OS

Image 11: OS global switch — get all available details

You can get specific details by querying as shown below:

wmic OS get OSArchitecture,Manufacturer, NumberOfProcesses, NumberOfUsers, SystemDrive

Image 12: OS global switch — get specific details

6. PROCESS — Process management

You will get all the details about current running processes while using this global switch like CommandLine, ExecutablePath, Name, ParentProcessId, Priority, ProcessId etc.

Get all the available attributes using below command:

wmic PROCESS

Whereas get the specific details using below command:

wmic PROCESS get Name, ParentProcessId, Priority, ProcessId

Image 13: PROCESS global switch — get specific details

In fact you can terminate a specific process using where clause as shown below:

wmic PROCESS where ProcessId=7100 call terminate

Here, we are terminating a process which has ProcessId as 7100 (Process ID may be different in your case). See the output below:

If you don’t know the process ID, then you can also use process name to terminate the process.

wmic PROCESS where name=”notepad.exe” call terminate

Image 13: PROCESS global switch — terminate specific process using WHERE clause

Note:

  1. All the above commands are used & output is generated on Windows 7 Operating System. Using other windows platforms may result in different outputs.
  2. WMIC execution may require some administrative privileges or elevation.

Conclusion:

WMIC provides various commands over WMI to provide details regarding various global switches like Computer System, CPU, Logical Disk, Network Interfaces, Operating System etc. You can use WHERE clause to filter the results.

That’s it from my side. Any suggestions & corrections are highly welcomed.

Stay happy 😊 & keep reading.

--

--