For those coming from a CLI based Linux world, WMIC is a great tool to get around Windows servers.
What is WMIC?
The Windows Management Instrumentation Command-line (WMIC) is a command-line and scripting interface that simplifies the use of Windows Management Instrumentation (WMI) and systems managed through WMI.
WMIC can provide a huge range of information about local and remote computers. This article shows WMIC usage on Windows Server 2008.
Using WMIC
WMIC is based on aliases. We can list the available aliases by using wmic /? help page:
> wmic /?
Below are some aliases we’re planning to use today:
- OS: Operating System.
- BIOS: BIOS management.
- CPU: Central Processing Unit.
- MEMPHYSICAL: Physical memory management.
- NIC: Network Interface Controller management.
- DISKDRIVE: Physical disk drive.
- USERACCOUNT: User accounts.
To get a brief overview of an alias, open CMD as Administrator and run:
> wmic <alias> list brief
Full alias overview can be displayed:
> wmic <alias> list full
Interactive mode is also available:
> wmic wmic:root\cli>
Type quit to exit interactive mode.
Get Information About Operating System
> wmic OS get Caption,CSDVersion,OSArchitecture,Version Caption CSDVersion OSArchitecture Version Microsoft® Windows Server® 2008 Datacenter Service Pack 2 64-bit 6.0.6002
Get Information About BIOS
> wmic BIOS get Manufacturer,Name,SMBIOSBIOSVersion,Version Manufacturer Name SMBIOSBIOSVersion Version Xen Revision: 1.221 3.4.3.amazon Xen - 0
Get Information About CPU
> wmic CPU get Name,NumberOfCores,NumberOfLogicalProcessors Name NumberOfCores NumberOfLogicalProcessors Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz 2 2
Get the Amount of RAM Installable for this Particular Memory Array
> wmic MEMPHYSICAL get MaxCapacity MaxCapacity 301989888
Get Memory Device DIMM Numbers
> wmic MEMORYCHIP get Capacity,DeviceLocator,PartNumber,Tag Capacity DeviceLocator PartNumber Tag 2147483648 DIMM_A2 HMT325R7BFR8A-H9 Physical Memory 1 2147483648 DIMM_A3 HMT325R7BFR8A-H9 Physical Memory 2 2147483648 DIMM_A5 HMT325R7BFR8A-H9 Physical Memory 4 2147483648 DIMM_A6 HMT325R7BFR8A-H9 Physical Memory 5 8589934592 DIMM_A8 9965516-099.A00LF Physical Memory 7 8589934592 DIMM_A9 9965516-099.A00LF Physical Memory 8 2147483648 DIMM_B2 HMT325R7BFR8A-H9 Physical Memory 10 2147483648 DIMM_B3 HMT325R7BFR8A-H9 Physical Memory 11 2147483648 DIMM_B5 HMT325R7BFR8A-H9 Physical Memory 13 2147483648 DIMM_B6 HMT325R7BFR8A-H9 Physical Memory 14 8589934592 DIMM_B8 9965516-099.A00LF Physical Memory 16 8589934592 DIMM_B9 9965516-099.A00LF Physical Memory 17
Get Information About NICs
> wmic NIC get Description,MACAddress,NetEnabled,Speed Description MACAddress NetEnabled Speed WAN Miniport (SSTP) WAN Miniport (L2TP) WAN Miniport (PPTP) 50:50:54:22:11:00 WAN Miniport (PPPOE) 33:50:6F:22:11:00 WAN Miniport (IPv6) WAN Miniport (Network Monitor) Microsoft ISATAP Adapter 100000 WAN Miniport (IP) Microsoft Tun Miniport Adapter 02:00:54:22:11:00 1073741824 RedHat PV NIC Driver 02:9B:9F:22:11:00 TRUE 100000000 RAS Async Adapter 20:41:53:22:11:00
Get Information About Physical Drives
> wmic DISKDRIVE get InterfaceType,Name,Size,Status InterfaceType Name Size Status SCSI \\.\PHYSICALDRIVE0 85896599040 OK SCSI \\.\PHYSICALDRIVE1 107372805120 OK SCSI \\.\PHYSICALDRIVE2 10733990400 OK SCSI \\.\PHYSICALDRIVE3 85896599040 OK SCSI \\.\PHYSICALDRIVE4 85896599040 OK
Get Information About User Accounts
> wmic USERACCOUNT get Caption,Name,PasswordRequired,Status Caption Name PasswordRequired Status SERVER2008\administrator administrator TRUE Degraded SERVER2008\Guest Guest FALSE Degraded SERVER2008\sandy sandy TRUE OK SERVER2008\patrick patrick TRUE OK
Get Serial Numbers of Hard Drives
> wmic path win32_physicalmedia get SerialNumber SerialNumber 9RXFA3FG Z2AP14Z2
You can use the freeware WMI Tools from AdRem Software to access WMI information both locally and remotely, as well as run custom WMI queries.
Could you assist? I need the driver version for the Network Interface Card as well as die Sound Card on the PC. I found the command for the Graphics Card (wmic path win32_VideoController get name, driverversion) which returns the correct information. I need similar command for NIC and SoundCard. Please could you help?
Check wmic nic and wmic sounddev.
I need to find a way to capture run-time off Windows systems, either per session or since initially booted with a particular image. Can I do that with a WMI command or deduce it from a particular output?
Sorry, I don’t know, my WMI skills are fairly limited.
You’re wrong on one thing :
wmic MEMPHYSICAL get MaxCapacity
give the max amount of memory your motherboard is able to handle.
wmic memorychip get capacity
give you the amount of memory, RAM by RAM, you’ve physically in your PC.
Thanks, I’ve updated the article.
how to merge them into one command that get os and cpu informatuions
Props on this post. Solved my problem.
wmic not working. Getting error when trying to call any command “A null reference pointer passed to stub”.