分享

Wmic 实例应用 (修改版) ①

 kinghill 2012-12-13
以下全是在cmd命令行中操作,命令格式就是“wmic+全局开关+别名+wql语句+动词+副词(或者说是动词的参数)+动词开关



至于别名,就是给主板、服务、系统、进程啦这些和计算机相关的东东起了个英文名,在wmic.exe /?命令行下也可以看到

wql语句和我们平常用的注入时的sql语句的语法几乎是一模一样,甚至更简单。一般是wherename="xxx" and 之类的,不过有时候要把name=“xxx"这样的格式换成"name='xxx'"或者是where(name='xxx')这样,反正正常情况下不行的话就换个写法。

动词呢,就那么简单几个assoc、call、CREATE、DELETE、GET、LIST、SET,



至于副词(动词的参数),就是得到用动词+它的参数得到对象的属性。像属于list动词的副词,就是显示个什么样的呀,例如显示详细状态或简要状态。

动词开关就好比显示个横表格式的或者显示个竖表格式的或者输出个什么样格式的文件,或者是几秒来重复显示信息等等,有的动词并没有开关

wmic /output:c:\process.html process get   processid,name,executablepath/format:htable

(wmic) +(全局开关) +      (别名)+ 动词(             副词            )+(动词开关)



BIOS管理

列1、显示bios信息

在cmd中输入:wmic bios list full

哈哈头晕了吗?先在cmd中输入mode con cols=1200 lines=20 回车后再输入wmic bioslist 这新就好看多了

list是一特定个参数,list决定显示的信息格式与范围

full是一个参数

FULL=全部显示,                               - BiosCharacteristics,(特征码)BuildNumber, CodeSet, CurrentLanguage, Description,(种类) IdentificationCode,(鉴定码)InstallableLanguages,(安装语言)InstallDate(安装数据), LanguageEdition,(语言版本) ListOfLanguages, Manufacturer,(制造厂商) Name,(名子) OtherTargetOS,(其它对象系统) PrimaryBIOS,(主bios) ReleaseDate,(版本日期)SerialNumber,(字符串) SMBIOSBIOSVersion,SMBIOSMajorVersion, SMBIOSMinorVersion, SMBIOSPresent, SoftwareElementID,SoftwareElementState, Status, TargetOperatingSystem, Version

INSTANCE=对象实例                             - Name

STATUS=状态                                   - Status, Name, Caption, SMBIOSPresent

SYSTEM=系统                                   - __CLASS, __DERIVATION, __DYNASTY, __GENUS, __NAMESPACE, __PATH, __PROPERTY_COUNT,__RELPATH, __SERVER, __SUPERCLASS



列2、显示bios信息

在cmd中输入:wmic bios get







列3、显示完整bios信息

在cmd中输入:wmic bios get /value

加上参数value显示更加直观





进程管理

列1、显示进程摘要信息

在cmd中输入:wmic process list brief

brief是一个参数,list决定显示的信息格式与范围,process是别名



可用下列 LIST 格式:



列2、显示进程完整信息

在cmd中输入:wmic process get



可用下列 LIST 格式:

也就是说在get后面追加下列参数如追加多个参数要用逗号隔开如:wmic process get csname,executablepath





列3、显示某个进程信息

在cmd中输入:wmic process where (description="ttplayer.exe")



列4

查询进程的启动路径(将得到的信息输出)

wmic process getname,executablepath,processid

wmic /output:c:\process.html process getprocessid,name,executablepath /format:htable





列5、结束一个进程(可根据进程对应的PID)

wmic process where name='outlook.exe' call terminate

wmic process wherename="notepad.exe" delete

wmic process wherename="notepad.exe" terminate

wmic process where pid="123"delete

wmic path win32_process where"name='notepad.exe'" delete





列出某个安装的程序的信息

wmic product getpackagename="*.msi"



删除安装的程序

wmic product where name="*"delete

wmic product where name="腾讯qq2009" delete



查询进程的启动路径(将得到的信息输出)

wmic process get

wmic /output:c:\process.html process getprocessid,name,executablepath /format:htable.xsl





查询指定进程的信息

wmic process wherename="notepad.exe" get name,executablepath,processid

::name=进程名、executablepath=路径、processid=进程ID





重启远程计算机

wmic /node:192.168.8.10 /user:administrator/password:xiongyefeng process call create "shutdown -r -f"



关闭远程计算机

wmic /node:192.168.8.10 /user:administrator/password:xiongyefeng process call create "shutdown -s -f"





创造一个进程

wmic process call create "d:\programfiles\ttplayer\ttplayer.exe"



在远程计算上创建进程

wmic /node:192.168.8.10 /user:administrator/password:xiongyefeng process call create "c:\windows\notepad.exe"





磁盘管理



查看远程主机C盘情况

WMIC /node:"192.168.8.100"/user:"administrator" /password:"lcx" /output:a.htmllogicaldisk where "name='c:'" getDeviceID,Size,FreeSpace,Description,FileSystem /format:htable

其中node开关表示对哪台机器进行访问,user和password当然是远程机器的用户名和密码了,这个命令有了以上的讲解,大家应当一目了然了吧。



列6、查看本机C盘情况

wmic logicaldisk where name="c:"get

::Caption=说明、 Compressed=压缩、  CreationClassName=创造类名称  Description=描述、 DeviceID=驱动器ID号  DriveType=驱动器类型、 FileSystem=文件系统、 FreeSpace=剩余空间、MaximumComponentLength   Size=总容量、Status=状态、SystemName=计算机名、VolumeName=卷标名、VolumeSerialNumber卷标字符串



查看磁盘的属性

wmic logicaldisk list brief

::caption=标题、driveID=驱动器ID号、model=产品型号、Partitions=分区、size=大小



查看物理磁盘的真实情况

wmic diskdrive list

::Caption说明、DeviceID=驱动器ID号、Model=原硬盘型号、 Partitions=分区总数、 Size=硬盘大小



获得U盘的盘符号

wmic logicaldisk where drivetype='2' getdeviceid,description

wmic logicaldisk where"drivetype=2" get name

::2=移动磁盘、3=本地磁盘、5=光驱。



更改卷标的名称

wmic logicaldisk where name="c:"set volumename=lsxq

::相当于label c: lsxq

  

安装包任务管理

列1 列出安装的程序及其它详解信息

wmic product get

::也可加上以下参数并用豆号隔开如:wmic prduct get name,installdate,



          

系统服务管理





wmic service wherename="TermService" get processid

::获得指定服务进程的PID号



wmic service where state='running' getname,displayname

::显示正在运行的服务





wmic service where state='running' getname,pathname

::显示已启动服务对应所在的可执行文件路径





wmic service wherename="sharedaccess" startservice

::启动一个服务





wmic service wherename="sharedaccess" stopservice

::停止一个服务



wmic service where name='sharedaccess'changestartmode 'automatic'

::将某个服务设为自启动(手动、禁用)



显示开机自启动的服务

wmic service where startmode='auto' getname,displayname

::

显示开始自启动并且当前处于运行状态的服务

wmic service where "startmode='auto'and state='running'" get name,displayname

::

显示禁用或手动启动的服务

wmic service where'startmode="disabled" or startmode="manual"' getname,displayname

::





文件管理



更改文件名

wmic datafile "c:\\temp\\1.txt"rename "c:\temp\2.txt"

::将c:\temp下的1.txt文件命名为2.txt



复制单个文件

wmic datafile "c:\\test.txt" copy"d:\lsxq.txt"



获得指定路径下特定扩展名的文件列表

wmic datafile where "drive='c:' andpath='\\' and extension='txt'" get name,Path,"System File"



删除文件夹

wmic fsdir "c:\\test" delete



文件夹重命名

wmic fsdir "c:\\test" rename"c:\lsxq"





复制文件夹

wmic fsdir where(name='c:\\temp\\ken') callcopy "d:\ken1"

::复制C盘下的ken文件夹里的文件到D盘ken1里面,如果D盘ken1文件夹不存在它会自动创健,如果存在则直接复制过去。



重命名文件夹

wmic fsdir where(name='d:\\zhangzhimin')rename "d:\ken"

::将d盘下的zhangzhimin文件夹命名为ken



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多