Chinaunix首页 | 论坛 | 博客
  • 博客访问: 781016
  • 博文数量: 99
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1163
  • 用 户 组: 普通用户
  • 注册时间: 2016-09-22 09:50
个人简介

一个守望数据库的老菜鸟

文章分类

全部博文(99)

文章存档

2019年(21)

2018年(17)

2017年(37)

2016年(24)

我的朋友

分类: WINDOWS

2016-10-19 12:52:25

博客文章除注明转载外,均为原创。转载请注明出处。
本文链接地址:http://blog.chinaunix.net/uid-31396856-id-5753603.html


     wmic(=Microsoft Windows Management Instrumentation)是windows的一个非常强大的管理工具。我对windows管理接触少之又少,cmd和bat是以前所知道的,开始学习wmic的使用,后续积累会不断持续更新...

1、wmic有哪些操作

1.信息的获取--get
2.创建--create
3.删除--delete
4.设置--set
5.列出---list
6.调用--call
7.分配--assoc

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


附上微软wmic命令学习:


---the end
阅读(2678) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~