设为首页 收藏本站
查看: 2038|回复: 0

[经验分享] WMIC

[复制链接]

尚未签到

发表于 2014-9-2 21:40:38 | 显示全部楼层 |阅读模式

系统帮助提示

  

[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.

  
  

For more information on a specific global switch, type: switch-name /?

  
  

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.

  

FSDIR                    - Filesystem directory entry management.

  

GROUP                    - Group account management.

  

IDECONTROLLER            - IDE Controller management.  

  

IRQ                      - Interrupt request line (IRQ) management.

  

JOB                      - Provides  access to the jobs scheduled using the schedule service.

  

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.

  

ONBOARDDEVICE            - Management of common adapter devices built into the motherboard (system board).

  

OS                       - Installed Operating System/s management.

  

PAGEFILE                 - Virtual memory file swapping management.

  

PAGEFILESET              - Page file settings management.

  

PARTITION                - Management of partitioned areas of a physical disk.

  

PORT                     - I/O port management.

  

PORTCONNECTOR            - Physical connection ports management.

  

PRINTER                  - Printer device management.

  

PRINTERCONFIG            - Printer device configuration management.  

  

PRINTJOB                 - Print job management.

  

PROCESS                  - Process management.

  

PRODUCT                  - Installation package task management.

  

QFE                      - Quick Fix Engineering.  

  

QUOTASETTING             - Setting information for disk quotas on a volume.

  

RDACCOUNT                - Remote Desktop connection permission management.

  

RDNIC                    - Remote Desktop connection management on a specific network adapter.

  

RDPERMISSIONS            - Permissions to a specific Remote Desktop connection.

  

RDTOGGLE                 - Turning Remote Desktop listener on or off remotely.

  

RECOVEROS                - Information that will be gathered from memory when the operating system fails.

  

REGISTRY                 - Computer system registry management.

  

SCSICONTROLLER           - SCSI Controller management.  

  

SERVER                   - Server information management.

  

SERVICE                  - Service application management.

  

SHADOWCOPY               - Shadow copy management.

  

SHADOWSTORAGE            - Shadow copy storage area management.

  

SHARE                    - Shared resource management.

  

SOFTWAREELEMENT          - Management of the  elements of a software product installed on a system.

  

SOFTWAREFEATURE          - Management of software product subsets of SoftwareElement.

  

SOUNDDEV                 - Sound Device management.

  

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.

  

SYSTEMENCLOSURE          - Physical system enclosure management.

  

SYSTEMSLOT               - Management of physical connection points including ports,  slots and peripherals, and proprietary connections points.

  

TAPEDRIVE                - Tape drive management.  

  

TEMPERATURE              - Data management of a temperature sensor (electronic thermometer).

  

TIMEZONE                 - Time zone data management.

  

UPS                      - Uninterruptible power supply (UPS) management.

  

USERACCOUNT              - User account management.

  

VOLTAGE                  - Voltage sensor (electronic voltmeter) data management.

  

VOLUME                   - Local storage volume management.

  

VOLUMEQUOTASETTING       - Associates the disk quota setting with a specific disk volume.

  

VOLUMEUSERQUOTA          - Per user storage volume quota management.

  

WMISET                   - WMI service operational parameters management.

  
  

For more information on a specific alias, type: alias /?

  
  

CLASS     - Escapes to full WMI schema.

  

PATH      - Escapes to full WMI object paths

  

CONTEXT   - Displays the state of all the global switches.

  

QUIT/EXIT - Exits the program.

  
  

For more information on CLASS/PATH/CONTEXT, type: (CLASS | PATH | CONTEXT) /?

  
  

以下内容来来自网络

  

1、.wmic=Microsoft Windows Management Instrumentation

  

2. C:\WINDOWS\system32\wbem 下的东西,特别是.xsl格式化文件,实现wmic的格式化输出,如

  

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

  

3.wmic可以做什么?系统管理、远程主机信息获取。。。都可以

  

4.wmic /?

  

查看wmic对象有何可用属性: wmic 对象名称 get /?   例如,wmic process get /?

  

查看wmic对象某个属性的值: wmic 对象名称 get 对象某个属性   例如

  

wmic process get name

  
  

PROCESS - 进程管理

  

::列出进程的核心信息,类似任务管理器   wmic process list brief

  

::新建notepad进程   wmic process call create notepad

  

::列出进程的信息   wmic process get caption,handle,commandline,executablepath

  

::结束进程   wmic process [handle/PID] delete  或者   wmic process [handle/PID] call terminate

  

::结束svchost.exe进程,路径为非C:\WINDOWS\system32\svchost.exe的

  

wmic process where "name='svchost.exe' and ExecutablePath<>'C:\\WINDOWS\\system32\\svchost.exe'" call Terminate

  

::结束svchost.exe进程,路径为C:\WINDOWS\svchost.exe的(关键点:路径中的\一定要换成\\)

  

wmic process where "name='svchost.exe' and ExecutablePath='C:\\WINDOWS\\svchost.exe'" call Terminate

  
  

BIOS - 基本输入/输出服务 (BIOS) 管理

  

::查看bios版本型号

  

wmic bios get name,SMBIOSBIOSVersion,manufacturer

  

COMPUTERSYSTEM - 计算机系统管理

  

::查看硬件、操作系统基本信息

  

wmic computersystem get Name,workgroup,NumberOfProcessors,manufacturer,Model

  

::查看系统启动选项boot.ini的内容

  

wmic computersystem get SystemStartupOptions

  

::查看工作组/域

  

wmic computersystem get domain

  

::更改计算机名abc为123

  

wmic computersystem where "name='abc'" call rename 123

  

::更改工作组google为MyGroup

  

wmic computersystem where "name='google'" call joindomainorworkgroup "","","MyGroup",1

  
  

CPU - CPU 管理

  

::查看cpu型号

  

wmic cpu get name

  
  

DATAFILE - DataFile 管理

  

::查找e盘下test目录(不包括子目录)下的cc.cmd文件

  

wmic datafile where "drive='e:' and path='\\test\\' and FileName='cc' and Extension='cmd'" list

  

::查找e盘下所有目录和子目录下的cc.cmd文件,且文件大小大于1K

  

wmic datafile where "drive='e:' and FileName='cc' and Extension='cmd' and FileSize>'1000'" list

  

::删除e盘下文件大小大于10M的.cmd文件

  

wmic datafile where "drive='e:' and Extension='cmd' and FileSize>'10000000'" call delete

  

::删除e盘下test目录(不包括子目录)下的非.cmd文件

  

wmic datafile where "drive='e:' and Extension<>'cmd' and path='test'" call delete

  

::复制e盘下test目录(不包括子目录)下的cc.cmd文件到e:\,并改名为aa.bat

  

wmic datafile where "drive='e:' and path='\\test\\' and FileName='cc' and Extension='cmd'" call copy "e:\aa.bat"

  

::改名c:\hello.txt为c:\test.txt

  

wmic datafile "c:\\hello.txt" call rename c:\test.txt

  

::查找h盘下目录含有test,文件名含有perl,后缀为txt的文件

  

wmic datafile where "drive='h:' and extension='txt' and path like '%\\test\\%' and filename like '%perl%'" get name

  
  

DESKTOPMONITOR - 监视器管理

  

::获取屏幕分辨率

  

wmic DESKTOPMONITOR where Status='ok' get ScreenHeight,ScreenWidth

  
  

DISKDRIVE - 物理磁盘驱动器管理

  

::获取物理磁盘型号大小等

  

wmic DISKDRIVE get Caption,size,InterfaceType

  
  

ENVIRONMENT - 系统环境设置管理

  

::获取temp环境变量

  

wmic ENVIRONMENT where "name='temp'" get UserName,VariableValue

  

::更改path环境变量值,新增e:\tools

  

wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;e:\tools"

  

::新增系统环境变量home,值为%HOMEDRIVE%%HOMEPATH%

  

wmic ENVIRONMENT create name="home",username="<system>",VariableValue="%HOMEDRIVE%%HOMEPATH%"

  

::删除home环境变量

  

wmic ENVIRONMENT where "name='home'" delete

  
  

FSDIR - 文件目录系统项目管理

  

::查找e盘下名为test的目录

  

wmic FSDIR where "drive='e:' and filename='test'" list

  

::删除e:\test目录下除过目录abc的所有目录

  

wmic FSDIR where "drive='e:' and path='\\test\\' and filename<>'abc'" call delete

  

::删除c:\good文件夹

  

wmic fsdir "c:\\good" call delete

  

::重命名c:\good文件夹为abb

  

wmic fsdir "c:\\good" rename "c:\abb"

  
  

LOGICALDISK - 本地储存设备管理

  

::获取硬盘系统格式、总大小、可用空间等

  

wmic LOGICALDISK get name,Description,filesystem,size,freespace

  
  

NIC - 网络界面控制器 (NIC) 管理

  
  

OS - 已安装的操作系统管理

  

::设置系统时间

  

wmic os where(primary=1) call setdatetime 20070731144642.555555+480

  
  

PAGEFILESET - 页面文件设置管理

  

::更改当前页面文件初始大小和最大值

  

wmic PAGEFILESET set InitialSize="512",MaximumSize="512"

  

::页面文件设置到d:\下,执行下面两条命令

  

wmic pagefileset create name='d:\pagefile.sys',initialsize=512,maximumsize=1024

  

wmic pagefileset where"name='c:\\pagefile.sys'" delete

  
  

PRODUCT - 安装包任务管理

  

::安装包在C:\WINDOWS\Installer目录下

  

::卸载.msi安装包

  

wmic PRODUCT where "name='Microsoft .NET Framework 1.1' and Version='1.1.4322'" call Uninstall

  

::修复.msi安装包

  

wmic PRODUCT where "name='Microsoft .NET Framework 1.1' and Version='1.1.4322'" call Reinstall

  
  

SERVICE - 服务程序管理

  

::运行spooler服务

  

wmic SERVICE where name="Spooler" call startservice

  

::停止spooler服务

  

wmic SERVICE where name="Spooler" call stopservice

  

::暂停spooler服务

  

wmic SERVICE where name="Spooler" call PauseService

  

::更改spooler服务启动类型[auto|Disabled|Manual] 释[自动|禁用|手动]

  

wmic SERVICE where name="Spooler" set StartMode="auto"

  

::删除服务

  

wmic SERVICE where name="test123" call delete

  
  

SHARE - 共享资源管理

  

::删除共享

  

wmic SHARE where name="e$" call delete

  

::添加共享

  

WMIC SHARE CALL Create "","test","3","TestShareName","","c:\test",0

  
  

SOUNDDEV - 声音设备管理

  

wmic SOUNDDEV list

  
  

STARTUP - 用户登录到计算机系统时自动运行命令的管理

  

::查看msconfig中的启动选项

  

wmic STARTUP list

  
  

SYSDRIVER - 基本服务的系统驱动程序管理

  

wmic SYSDRIVER list

  
  

USERACCOUNT - 用户帐户管理

  

::更改用户administrator全名为admin

  

wmic USERACCOUNT where name="Administrator" set FullName="admin"

  

::更改用户名admin为admin00

  

wmic useraccount where "name='admin" call Rename admin00



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-24283-1-1.html 上篇帖子: VPS选取独立IP的五大理由 下篇帖子: DELL R720安装REDHAT5.1 RAID驱动问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表