2、开始使用
C:\Windows\System32>wmic /?
下面是使用说明,中间有省略
[global switches]
The following global switches are available:
/NAMESPACE Path for the namespace the alias operate against.
/ROLE Path for the role containing the alias definitions.
/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.
/USER User to be used during the session.
/PASSWORD Password to be used for session login.
/OUTPUT Specifies the mode for output redirection.
.......
/?[:] Usage information.
The following alias/es are available in the current role:
ALIAS - Access to the aliases available on the local system
BASEBOARD - Base board (also known as a motherboard or system board) management.
BIOS - Basic input/output services (BIOS) management.
BOOTCONFIG - Boot configuration management.
CDROM - CD-ROM management.
COMPUTERSYSTEM - Computer system management.
CPU - CPU management.
CSPRODUCT - Computer system product information from SMBIOS.
DATAFILE - DataFile Management.
DCOMAPP - DCOM Application management.
DESKTOP - User's Desktop management.
DESKTOPMONITOR - Desktop Monitor management.
DEVICEMEMORYADDRESS - Device memory addresses management.
DISKDRIVE - Physical disk drive management.
DISKQUOTA - Disk space usage for NTFS volumes.
DMACHANNEL - Direct memory access (DMA) channel management.
ENVIRONMENT - System environment settings management.
GROUP - Group account management.
IDECONTROLLER - IDE Controller management.
IRQ - Interrupt request line (IRQ) management.
LOADORDER - Management of system services that define execution dependencies.
LOGICALDISK - Local storage device management.
LOGON - LOGON Sessions.
MEMCACHE - Cache memory management.
MEMORYCHIP - Memory chip information.
MEMPHYSICAL - Computer system's physical memory management.
NETCLIENT - Network Client management.
NETLOGIN - Network login information (of a particular user) management.
NETPROTOCOL - Protocols (and their network characteristics) management.
NETUSE - Active network connection management.
NIC - Network Interface Controller (NIC) management.
NICCONFIG - Network adapter management.
NTDOMAIN - NT Domain management.
NTEVENT - Entries in the NT Event Log.
NTEVENTLOG - NT eventlog file management.
OS - Installed Operating System/s management.
PARTITION - Management of partitioned areas of a physical disk.
PORT - I/O port management.
PROCESS - Process management.
PRODUCT - Installation package task management.
SERVER - Server information management.
SERVICE - Service application management.
SHARE - Shared resource management.
SOFTWAREELEMENT - Management of the elements of a software product installed on a system.
STARTUP - Management of commands that run automatically when users log onto the computer system.
SYSACCOUNT - System account management.
SYSDRIVER - Management of the system driver for a base service.
USERACCOUNT - User account management.
VOLUME - Local storage volume management.
WMISET - WMI service operational parameters management.
读到这个,心里大致有个数,有使用一些基础的就可以了,有新的需求就可以查了。
3、wmic的输出
/output 输出为文本文件,还有html,表格,表,excel等格式。常见格式输入如下:
wmic /output:c:\process.html process list /format:htable.xsl
/format:textvaluelist.xsl
/format:hform.xsl
/format:htable.xsl
/format:csv.xsl
/format:xml.xsl
4、使用举例
(1) 获取系统版本信息
C:\Windows\System32>wmic datafile where Name='c:\\windows\\explorer.exe' get Manufacturer,Version,Filename
FileName Manufacturer Version
explorer Microsoft Corporation 6.1.7601.17567
(2)cpu 信息
C:\Windows\System32>wmic cpu list brief
Caption DeviceID Manufacturer MaxClockSpeed Name SocketDesignation
Intel64 Family 6 Model 69 Stepping 1 CPU0 GenuineIntel 2501 Intel(R) Core(TM
(3)磁盘信息
C:\Windows\System32>wmic logicaldisk list brief
DeviceID DriveType FreeSpace ProviderName Size VolumeName
C: 3 51418832896 78020866048 Win7
D: 3 97266167808 131071995904 新加卷
E: 3 214445834240 291012341760 新加卷
F: 3 11987767296 16011751424 新加卷
(4)
C:\Windows\System32>wmic MEMCACHE list brief
BlockSize CacheSpeed CacheType DeviceID InstalledSize Level MaxCacheSize NumberOfBlocks Status
1024 4 Cache Memory 0 32 3 32 32 OK
1024 3 Cache Memory 1 32 3 32 32 OK
1024 5 Cache Memory 2 256 4 256 256 OK
1024 5 Cache Memory 3 3072 5 3072 3072 OK
(5)计算机信息
C:\Windows\System32>wmic computersystem get Name,workgroup,NumberOfProcessors,ma
nufacturer,Model
Manufacturer Model Name NumberOfProcessors Workgroup
LENOVO 20BVA04QCD DBAWATCHER 1 WORKGROUP