獲得系統版本信息
wmic datafile where Name='c:\\windows\\explorer.exe' get Manufacturer,Version,Filename
獲得系統進程
wmic process list full 注意:
這里的full也可以換成brief(簡潔)
獲得硬件信息(這里以cpu為例)
wmic cpu get name,caption,maxclockspeed,description
將結果輸出到d盤的1.txt里面
wmic /output:D:\1.txt cpu get name
wmic 獲取硬盤固定分區盤符:
wmic logicaldisk where "drivetype=3" get name
wmic 獲取硬盤各分區文件系統以及可用空間:
wmic logicaldisk where "drivetype=3" get name,filesystem,freespace
wmic 獲取進程名稱以及可執行路徑:
wmic process get name,executablepath
wmic 刪除指定進程(根據進程名稱):
wmic process where name="qq.exe" call terminate
或者用
wmic process where name="qq.exe" delete
wmic 刪除指定進程(根據進程PID):
wmic process where pid="123" delete
wmic 創建新進程
wmic process call create "C:\Program Files\Tencent\QQ\QQ.exe"
在遠程機器上創建新進程:
wmic /node:192.168.1.10 /user:administrator /password:123456 process call create cmd.exe
關閉本地計算機
wmic process call create shutdown.exe
重啟遠程計算機
wmic /node:192.168.1.10/user:administrator /password:123456 process call create "shutdown.exe -r -f -m"
更改計算機名稱
wmic computersystem where "caption='%ComputerName%'" call rename newcomputername
更改帳戶名
wmic USERACCOUNT where "name='%UserName%'" call rename newUserName
wmic 結束可疑進程(根據進程的啟動路徑)
wmic process where "name='explorer.exe' and executablepath<>'%SystemDrive%\\windows\\explorer.exe'" delete
wmic 獲取物理內存
wmic memlogical get TotalPhysicalMemory|find /i /v "t"
wmic 獲取文件的創建、訪問、修改時間
@echo off
'wmic datafile where name^="c:\\windows\\system32\\notepad.exe" get CreationDate^,LastAccessed^,LastModified
wmic 全盤搜索某文件並獲取該文件所在目錄
wmic datafile where "FileName='qq' and extension='exe'" get drive,path
for /f "skip=1 tokens=1*" %i in ('wmic datafile where "FileName='qq' and extension='exe'" get drive^,path') do (set "qPath=%i%j" &@echo %qPath:~0,-3%)
獲取屏幕分辨率
wmic DESKTOPMONITOR where Status='ok' get ScreenHeight,ScreenWidth
獲取共享資源(包括隱藏共享)
WMIC share list brief
獲取U盤盤符,並運行U盤上的QQ.exe
@for /f "skip=1 tokens=*" %i in ('wmic logicaldisk where "drivetype=2" get name') do (if not "%i"=="" start d:\qq.exe)
獲得進程當前占用的內存和最大占用內存的大小:
wmic process where caption='filename.exe' get WorkingSetSize,PeakWorkingSetSize
更改現有工作組為指定的工作組
wmic computersystem Where "name='計算機名稱' call UnjoinDomainOrWorkgroup
退出所在域
wmic computersystem Where "name='計算機名稱'" call joindomainorworkgroup "",1,"域名稱","域管理員密碼","域管理員用戶名"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
開2003的3389
wmic RDTOGGLE WHERE ServerName='%COMPUTERNAME%' call
SetAllowTSConnections 1
遠程打開計算機遠程桌面
wmic /node:%pcname% /USER:%pcaccount% PATH win32_terminalservicesetting WHERE (__Class!="") CALL SetAllowTSConnections 1
添加的計划任務,wmic添加的同樣AT命令也是可以看到
wmic job call create "sol.exe",0,0,true,false,********154800.000000+480
wmic job call create "sol.exe",0,0,1,0,********154600.000000+480
這兩句是相同的,TRUE可以用1表示,同樣的FALSE可以用0值表示,時間前為何用八個星號,這是WMIC的特性,他顯示時間的方式是YYYYMMDDHHMMSS.MMMMMM+時區 ,可是,我們並不需要指定年份和月份還有天,所以用*星號來替代
在wmic下查看BIOS信息
wmic bios list full
wmic還有停止、暫停和運行服務的功能:
啟動服務startservice,停止服務stopservice,暫停服務pauseservice。
具體的命令使用格式就是:
wmic Service where caption=”windows time” call stopservice
●--停止服務
wmic Service where caption=”windows time” call startservice
●--啟動服務
wmic Service where name=”w32time” call stopservice
●--停止服務,注意name和caption的區別。
遠程創建進程
wmic
/node:109.254.2.102 /user:"rdgad\administrator" /password:"1234"
process call create commandline="cmd.exe /k echo xxxxx|clip.exe"