WHAT IS WMIC ? USEFUL WMIC COMMAND EXAMPLES IN WINDOWS ( PART 1 )
The Windows Management Instrumentation Command line (WMIC) is a software utility that allows users to performs Windows Management Instrumentation (WMI) operations with a command prompt.
WMIC operates in two modes, interactive (which allows commands to be entered one line at a time) and non-interactive (which allows commands to be scripted for use in batch files). The simplest way to launch WMIC is to open a Run dialog and type wmic. Windows users can review a complete listing of aliases and global switches by typing /? at the wmic prompt.
In this example I will take you through 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.
Useful wmic command examples in Windows
Also Read: Useful net command examples to Manage Windows Resources
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.
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.
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:
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.
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.
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.
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.
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.
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.
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.157.128 /user:administrator /password:p@ssw0rd computersystem get username command as shown below.
NOTE:
wmic /node:192.168.157.128 /user:administrator /password:p@ssw0rd computersystem get TotalPhysicalMemory
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.