Cyberithub

20 Useful wmic command examples in Windows | Cheat Sheet

Advertisements

In this example I will take you through 20 useful wmic command examples in Windows. wmic utility provides a command-line interface for Windows Management Instrumentation(WMI). Windows command line lovers can use this utility to query WMI entries. We will see some real world examples of wmic command in below section. More on Microsoft docs.

20 Useful wmic command examples in Windows | Cheat Sheet

Useful wmic command examples in Windows

Also Read: 27 Useful net command examples to Manage Windows Resources

Advertisements

Example 1: How to Display the State of all the Global Switches in Windows

If you want to check the state of all global switches in windows then you need to use wmic context command as shown below.

C:\>wmic context
NAMESPACE : root\cimv2
ROLE : root\cli
NODE(S) : DESKTOP-JSK6PD
IMPLEVEL : IMPERSONATE
[AUTHORITY : N/A]
AUTHLEVEL : PKTPRIVACY
LOCALE : ms_409
PRIVILEGES : ENABLE
TRACE : OFF
RECORD : N/A
INTERACTIVE : OFF
FAILFAST : OFF
OUTPUT : STDOUT
APPEND : STDOUT
USER : N/A
AGGREGATE : ON

 

Example 2: How to Get Your System Serial Number

If you want to check your system serial number then you need to use wmic bios get serialnumber command as shown below.

Advertisements
C:\>wmic bios get serialnumber
SerialNumber
FYNGK07

 

Example 3: How to Check HotFixID of all the Installed Updates in Windows

If you want to check the HotfixID of all the installed updates in windows then you need to use wmic qfe list command as shown below.

NOTE:

Advertisements
Please note that it is possible that some of the updates will show in "View Installed Updates" section but not on wmic qfe list output.
C:\>wmic qfe list
Caption CSName Description FixComments HotFixID InstallDate InstalledBy InstalledOn Name ServicePackInEffect Status
http://support.microsoft.com/?kbid=5003537 DESKTOP-JSK6PD Update KB5003537 NT AUTHORITY\SYSTEM 7/2/2021 
https://support.microsoft.com/help/4562830 DESKTOP-JSK6PD Update KB4562830 NT AUTHORITY\SYSTEM 2/10/2021 
http://support.microsoft.com/?kbid=4570334 DESKTOP-JSK6PD Security Update KB4570334 11/18/2020 
https://support.microsoft.com/help/4577586 DESKTOP-JSK6PD Update KB4577586 NT AUTHORITY\SYSTEM 2/19/2021 
https://support.microsoft.com/help/4580325 DESKTOP-JSK6PD Security Update KB4580325 11/19/2020 
https://support.microsoft.com/help/4586864 DESKTOP-JSK6PD Security Update KB4586864 11/19/2020 
https://support.microsoft.com/help/4589212 DESKTOP-JSK6PD Update KB4589212 NT AUTHORITY\SYSTEM 3/23/2021 
https://support.microsoft.com/help/4598481 DESKTOP-JSK6PD Security Update KB4598481 NT AUTHORITY\SYSTEM 2/10/2021 
https://support.microsoft.com/help/5004237 DESKTOP-JSK6PD Security Update KB5004237 NT AUTHORITY\SYSTEM 7/16/2021 
DESKTOP-JSK6PD Security Update KB5003742 NT AUTHORITY\SYSTEM 7/9/2021

 

Example 4: How to Get the List of all Installed Applications in Windows

If you want get the list of all the installed applications in your Windows system then you need to use wmic product get name command as shown below.

C:\>wmic product get name
Name
Windows 7 USB/DVD Download Tool
Office 16 Click-to-Run Extensibility Component
Office 16 Click-to-Run Localization Component
Office 16 Click-to-Run Extensibility Component 64-bit Registration
Office 16 Click-to-Run Licensing Component
Microsoft Update Health Tools
Oracle VM VirtualBox 6.1.18
Adobe Refresh Manager
Adobe Acrobat Reader DC
Kaspersky VPN

Kaspersky Total Security
PuTTY release 0.74 (64-bit)
Kaspersky Password Manager

 

Example 5: How to Count the number of Installed Updates in Windows

If you want to get the total count of installed updates in windows then you need to use wmic qfe list | find /c /v "" command as shown below.

Advertisements
C:\>wmic qfe list | find /c /v ""
12

 

Example 6: How to Get the Total Number of CPU Cores in Windows

If you want to check the total number of CPU Cores in your system then you need to use wmic cpu get numberofcores command as shown below. As you can see my system has 4 CPU Cores.

C:\>wmic cpu get numberofcores
NumberOfCores
4

 

Example 7: How to find the Process Id of a running program in Windows

If you are looking to check the process Id of a running program then you need to use wmic process where ExecutablePath='<process_executable_path>' get ProcessId syntax. In this example we are checking the Process Id of notepad.exe using wmic process where ExecutablePath='C:\\windows\\system32\\notepad.exe' get ProcessId command as shown below.

C:\>wmic process where ExecutablePath='C:\\windows\\system32\\notepad.exe' get ProcessId
ProcessId
9632
5392

 

Example 8: How to Get the System Bios Version using wmic command

If you want to check the System Bios Version then you need to use wmic bios get version command as shown below.

C:\>wmic bios get version
Version
DELL - 20170001

 

Example 9: How to Get All the Users logged in to a Remote System

If you are looking to check all the logged in to users in a remote system then you can use below wmic command. In this example we are checking all currently logged in users in 192.168.27.103 system by using wmic /node:192.168.27.103 /user:admin /password:pass123 computersystem get username command as shown below.

NOTE:

Please note that here I am using remote server administrator account admin and password pass123 for querying the number of logged in users.
C:\>wmic /node:192.168.27.103 /user:admin /password:pass123 computersystem get username

 

Example 10: How to Check all the logs related to Explorer

If you want to check all the logs related to explorer then you need to use wmic ntevent where (message like "%explorer%") list brief command as shown below.

C:\>wmic ntevent where (message like "%explorer%") list brief
EventIdentifier EventType Message RecordNumber SourceName TimeGenerated
1001 3 Fault bucket 1920831938051734614, type 5Event Name: AppHangXProcB1Response: Not availableCab Id: 0Problem signature:P1: SnippingTool.exeP2: 10.0.19041.746P3: eb13aef9P4: 7906P5: 134217744P6: explorer.exeP7: 10.0.19041.964P8: P9: P10: Attached files:\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERB726.tmp.WERInternalMetadata.xml\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERB737.tmp.xml\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERB736.tmp.csv\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERB766.tmp.txt\\?\C:\Users\bholu\AppData\Local\Temp\WERBE2D.tmp.appcompat.txtThese files may be available here:\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppHang_SnippingTool.exe_8ac07f9eac8f4087f48567a8def0533923dde231_4958eda7_88513af1-b46c-47b0-b41d-0e97480dc92fAnalysis symbol: Rechecking for solution: 0Report Id: 10c89b18-905b-46e5-9f4a-798cc5341758Report Status: 268435456Hashed bucket: 3608dbed5bb45864faa82a787ccc7c56Cab Guid: 0 10604 Windows Error Reporting 20210610160144.722031-000
10002 3 The following application was terminated because it was hung: explorer.exe.

 

Example 11: How to Get the Product ID of Your System using wmic command

If you want to check the ProductID of your System then you need to use wmic csproduct get name command as shown below.

C:\>wmic csproduct get name
Name
Inspiron 3493

 

Example 12: How to Get the List of all running Processes using wmic command

If you want to check all the current running processes then you need to use wmic process list command as shown below.

C:\>wmic process list
CommandLine CSName Description ExecutablePath ExecutionState Handle HandleCount InstallDate KernelModeTime MaximumWorkingSetSize MinimumWorkingSetSize Name OSName OtherOperationCount OtherTransferCount PageFaults PageFileUsage ParentProcessId PeakPageFileUsage PeakVirtualSize PeakWorkingSetSize Priority PrivatePageCount ProcessId QuotaNonPagedPoolUsage QuotaPagedPoolUsage QuotaPeakNonPagedPoolUsage QuotaPeakPagedPoolUsage ReadOperationCount ReadTransferCount SessionId Status TerminationDate ThreadCount UserModeTime VirtualSize WindowsVersion WorkingSetSize WriteOperationCount WriteTransferCount
DESKTOP-JSK6PD System Idle Process 0 0 8982450000000 System Idle Process Microsoft Windows 10 Home Single Language|C:\Windows|\Device\Harddisk1\Partition3 0 0 9 60 0 60 8192 12 0 61440 0 1 0 1 0 0 0 0 8 0 8192 10.0.19042 8192 0 0

 

Example 13: How to Get the Executable path of a running process

If you want to get the full executable path of any specific process then you need to use wmic process where "name=<process_name>" get ProcessID,ExecutablePath syntax. In this example, we are checking the executable path of chrome.exe process using wmic process where "name=chrome.exe" get ProcessID, ExecutablePath command as shown below.

C:\>wmic process where "name='chrome.exe'" get ProcessID, ExecutablePath
ExecutablePath ProcessId
C:\Program Files\Google\Chrome\Application\chrome.exe 2492
C:\Program Files\Google\Chrome\Application\chrome.exe 4252
C:\Program Files\Google\Chrome\Application\chrome.exe 1536
C:\Program Files\Google\Chrome\Application\chrome.exe 4792
C:\Program Files\Google\Chrome\Application\chrome.exe 8960
C:\Program Files\Google\Chrome\Application\chrome.exe 10288
C:\Program Files\Google\Chrome\Application\chrome.exe 10360
C:\Program Files\Google\Chrome\Application\chrome.exe 10464
C:\Program Files\Google\Chrome\Application\chrome.exe 10860

 

Example 14: How to Get the Executable of all the Process

If you want to get the executable path of all the running process then you need to use wmic process get ProcessID,ExecutablePath command as shown below.

C:\>wmic process get ProcessID,ExecutablePath
ExecutablePath ProcessId
0
4
124
724
812
908
916

 

Example 15: How to Get all the Information about System CPU

If you want to check all the information about System CPU then you can use wmic CPU Get DeviceID,NumberOfCores,NumberOfLogicalProcessors command as shown below.

C:\>wmic CPU Get DeviceID,NumberOfCores,NumberOfLogicalProcessors
DeviceID NumberOfCores NumberOfLogicalProcessors
CPU0 4 8

 

Example 16: How to Get the Windows OS version using wmic command

If you want to check the Windows OS version then you need to use wmic os get version command as shown below.

C:\>wmic os get version
Version
10.0.19042

 

Example 17: How to Get the System Slot Status using wmic command

If you want to check the status about your System slots then you can use wmic systemslot get slotdesignation,currentusage,description,status command as shown below.

C:\>wmic systemslot get slotdesignation,currentusage,description,status
CurrentUsage Description SlotDesignation Status
3 System Slot PCI-Express 0 OK
3 System Slot PCI-Express 1 OK
3 System Slot PCI-Express 2 OK
3 System Slot PCI-Express 3 OK
3 System Slot PCI-Express 4 OK
3 System Slot PCI-Express 5 OK
3 System Slot PCI-Express 6 OK

 

Example 18: How to Get the System Sensor Status using wmic command

If you want to get the system sensor status then you need to use wmic temperature get deviceid,name,status command as shown below.

C:\>wmic temperature get deviceid,name,status
DeviceID Name Status
root\cimv2 0 Numeric Sensor OK
root\cimv2 1 Numeric Sensor OK
root\cimv2 2 Numeric Sensor OK

 

Example 19: How to Get the List of all System I/O Ports using wmic command

If you want to check all the System I/O ports then you need to use wmic port get name command as shown below.

C:\>wmic port get name
Name
0x0000002E-0x0000002F
0x0000004E-0x0000004F
0x00000061-0x00000061
0x00000063-0x00000063
0x00000065-0x00000065
0x00000067-0x00000067
0x00000070-0x00000070
0x00000080-0x00000080
0x00000092-0x00000092
0x000000B2-0x000000B3
..................

 

Example 20: How to Check all the options available with wmic command

If you want to check all the option available with wmic command then you need to use wmic /? command as shown below.

C:\>wmic /?

[global switches] <command>

The following global switches are available:
/NAMESPACE Path for the namespace the alias operate against.
/ROLE Path for the role containing the alias definitions.
/NODE Servers the alias will operate against.
/IMPLEVEL Client impersonation level.
/AUTHLEVEL Client authentication level.
/LOCALE Language id the client should use.
/PRIVILEGES Enable or disable all privileges.
/TRACE Outputs debugging information to stderr.
/RECORD Logs all input commands and output.
/INTERACTIVE Sets or resets the interactive mode.
/FAILFAST Sets or resets the FailFast mode.
/USER User to be used during the session.
/PASSWORD Password to be used for session login.
/OUTPUT Specifies the mode for output redirection.
/APPEND Specifies the mode for output redirection.
/AGGREGATE Sets or resets aggregate mode.
/AUTHORITY Specifies the <authority type> for the connection.
/?[:<BRIEF|FULL>] Usage information.

5 thoughts on “20 Useful wmic command examples in Windows | Cheat Sheet”

  1. struggled for 2 days wmic installed in win 11 yet i am unable to get wmic working. j work on hp pavilion. frustrated please help.

    Reply
  2. Get network connection speed:
    wmic nic get name,speed

    List all wmi class aliases. You can use them with powershell get-wmiobject:
    wmic alias get friendlyname,target

    Reply

Leave a Comment