什么是WMIC
WMIC是扩展WMI(Windows Management Instrumentation,Windows管理规范),提供了从命令行接口和批命令脚本执行系统管理的支持。
和上面的官方定义比起来,还有一个更好理解的解释:WMIC,是一款命令行管理工具。
使用WMIC,我们不但可以管理本地计算机,而且还可以管理同一Windows域内的所有远程计算机(需要必要的权限),而被管理的远程计算机不必事先安装WMIC,只需要支持WMI即可。
WMIC能做什么
可以使用WMIC实现如下的管理任务:
- 本地计算机管理
- 远程单个计算机管理
- 远程多个计算机管理
- 使用远程会话的计算机管理(如Telnet)
- 使用管理脚本的自动管理
WMIC使用
运行WMIC打开“开始”-“运行”栏,输入“WMIC”就可以启动wmic了。
第一次运行时,会显示WMIC正在安装,请稍等,安装完后就可以使用了。
WMIC下的命令在窗口下输入process
执行看看,列出了正在运行的进程和调用进程的路径。
当然了,我们也可以输入process list brief
来查看更详细的信息,比如进程名称、ID、优先级等。
更重要的是,对于现在有些可以在任务管理器里隐藏进程的木马,要想在wmic里隐藏,可就没那么容易了,它会成为你查杀木马的好帮手。
现在只是知道了路径,如果怀疑某一进程,想查看它的详细信息又该怎么办呢?
那输入process where name=‘xx.exe’ list full
就可以了。
我们还可以使用以下命令来杀死进程:process where name=’xx.exe’ delete
,回车后就会提示我们是否删除,这里将delete换成call terminate
也可以达到同样的效果。
在wmic下如何查看BIOS信息呢?我们输入bios list full
,很实用的命令吧,不用重启电脑就可以知道你现在使用的电脑的BIOS信息了。
除此之外,wmic还有停止、暂停和运行服务的功能:启动服务startservice
,停止服务stopservice
,暂停服务pauseservice
。
Service where caption="windows time" call stopservice #停止服务 Service where caption="windows time" call startservice #启动服务 Service where name="w32time" call stopservice #停止服务 # 注意name和caption的区别。
想要知道更多的命令,直接在命令行下输入/?
,就可以获得详细的帮助信息了。
很多人制作的批处理或者脚本功能都是调用wmi实现的,它所具有的查看功能非常强大,尤其是安装了WMIC的电脑可以连接到任何一台安装了WMI的电脑,被连接的电脑不需要安装WMIC。
比如我们要查看局域网内所有计算机的进程,监视对方计算机进程等,至于其他更多的功能就请读者自己去挖掘吧。
常用命令
- BIOS – 基本输入/输出服务 (BIOS) 管理。
- BOOTCONFIG – 启动配置管理。
- COMPUTERSYSTEM – 计算机系统管理。
- CPU – CPU 管理。DESKTOP – 用户桌面管理。
- DISKDRIVE – 物理磁盘驱动器管理。
- ENVIRONMENT – 系统环境设置管理。
- FSDIR – 文件目录系统项目管理。
- GROUP – 组帐户管理。
- JOB – 提供对使用计划服务安排的工作的访问。
- LOGON – 登录会话。
- MEMCACHE – 缓存内存管理。
- MEMLOGICAL – 系统内存管理 (配置布局和内存可用性)。
- MEMPHYSICAL – 计算机系统物理内存管理。
- NETCLIENT – 网络客户端管理。
- NNETPROTOCOL – 协议 (和其网络特点) 管理。
- NICCONFIG – 网络适配器管理。
- OS – 已安装的操作系统管理。
- PAGEFILE – 虚拟内存文件对调管理。
- PARTITION – 物理磁盘分区区域的管理。
- PROCESS – 进程管理。
- PRODUCT – 安装包任务管理。
- REGISTRY – 计算机系统注册表管理。
- SHARE – 共享资源管理。
- STARTUP – 用户登录到计算机系统时自动运行命令的管理。
- SYSACCOUNT – 系统帐户管理。
- TIMEZONE – 时间区域数据管理。
- USERACCOUNT – 用户帐户管理。
实例
系统环境变量
# 创建系统环境变量 wmic ENVIRONMENT create name="MyPath",username="<system>",VariableValue="MyValue" # 修改环境变量 wmic ENVIRONMENT where "name='MyPath' and username='<system>'" set VariableValue="ChangedValue" # 删除环境变量 wmic ENVIRONMENT where "name='MyPath'" delete
进程
# 获取进程名称以及可执行路径: wmic process get name,executablepath # 删除指定进程(根据进程名称): wmic process where name="qq.exe" call terminate # 或者 wmic process where name="qq.exe" delete # 删除指定进程(根据进程PID): wmic process where pid="123" delete # 结束可疑进程(根据进程的启动路径) wmic process where "name='explorer.exe' and executablepath<>'%SystemDrive%\\windows\\explorer.exe'" delete # 创建新进程 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 memlogical get TotalPhysicalMemory|find /i /v "t" # 获取屏幕分辨率 wmic DESKTOPMONITOR where Status='ok' get ScreenHeight,ScreenWidthwmic PageFileSet set InitialSize="512",MaximumSize="512" # 查看cpu wmic cpu list brief # 查看物理内存 wmic memphysical list brief # 查看逻辑内存 wmic memlogical list brief # 查看缓存内存 wmic memcache list brief # 查看虚拟内存 wmic pagefile list brief # 查看网卡 wmic nic list brief # 查看网络协议 wmic netprotocal list brief
文件操作
获取文件的创建、访问、修改时间
@echo off for /f "skip=1 tokens=1,3,5 delims=. " %%a in ('wmic datafile where name^="c:\\windows\\system32\\notepad.exe" get CreationDate^,LastAccessed^,LastModified') do ( set a=%%a set b=%%b set c=%%c echo 文件: c:\windows\system32\notepad.exe echo.echo 创建时间: %a:~0,4% 年 %a:~4,2% 月 %a:~6,2% 日 %a:~8,2% 时 %a:~10,2% 分 %a:~12,2% 秒 echo 最后访问: %b:~0,4% 年 %b:~4,2% 月 %b:~6,2% 日 %b:~8,2% 时 %b:~10,2% 分 %b:~12,2% 秒 echo 最后修改: %c:~0,4% 年 %c:~4,2% 月 %c:~6,2% 日 %c:~8,2% 时 %c:~10,2% 分 %c:~12,2% 秒 ) echo.pause
全盘搜索某文件并获取该文件所在目录
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%)
其他
设置虚拟内存到E盘,并删除C盘下的页面文件,重启计算机后生效
wmic PageFileSet create name="E:\\pagefile.sys",InitialSize="1024",MaximumSize="1024" wmic PageFileSet where "name='C:\\pagefile.sys'" delete
获得进程当前占用的内存和最大占用内存的大小:
wmic process where caption='filename.exe' get WorkingSetSize,PeakWorkingSetSize
以KB为单位显示
@echo off for /f "skip=1 tokens=1-2 delims= " %%a in ('wmic process where caption^="conime.exe" get WorkingSetSize^,PeakWorkingSetSize') do ( set /a m=%%a/1024 set /a mm=%%b/1024 echo 进程conime.exe现在占用内存:%m%K;最高占用内存:%mm%K ) pause
远程打开计算机远程桌面
wmic /node:%pcname% /USER:%pcaccount% PATH win32_terminalservicesetting WHERE (__Class!="") CALL SetAllowTSConnections 1
检测是否插入U盘的批处理
@echo off ((wmic logicaldisk where "drivetype=2" get name|find "无可用范例")>nul 2>nul)||for /f "skip=1 tokens=* delims=" %%i in ('wmic logicaldisk where "drivetype=2" get name') do echo U盘盘符是 %%i pause
将当前系统BIOS,CPU,主板等信息输出到一个HTML网页文件
::得到系统信息.bat,运行bat文件即可 ::系统信息输出到HTML文件,查看帮助: wmic /? ::wmic [系统参数名] list [brief|full] /format:hform >|>> [文件名] wmic bios list brief /format:hform > PCinfo.html wmic baseboard list brief /format:hform >>PCinfo.html wmic cpu list full /format:hform >>PCinfo.html wmic os list full /format:hform >>PCinfo.html wmic computersystem list brief /format:hform >>PCinfo.html wmic diskdrive list full /format:hform >>PCinfo.html wmic memlogical list full /format:hform >>PCinfo.html PCinfo.html
人若是看透了自己,
便不会小看别人。
《骆驼祥子》
——老舍
评论
Your means of explaining all in this post is actually fastidious, every one can easily know it, Thanks
a lot https://www.cabanoneco.ca/
Your method of describing all in this post is truly good, all
be able to effortlessly understand it, Thanks a lot https://linktr.ee/pub020
After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader. Website : https://www.fastlinks.com.tr/
Thank you great posting about essential oil. Hello Administ . Website : https://301.com.tr/
güvenilir bahis siteleri
Your method of explaining the whole thing in this paragraph is in fact nice, all can easily understand it, Thanks a lot https://linktr.ee/pub016
I really love to read such an excellent article. Helpful article. Hello Administ . Website : https://www.fastlinks.com.tr/
Thank you great post. Hello Administ . Website : https://301.com.tr/
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across.国产线播放免费人成视频播放
It’s hard to come by well-informed people about this topic, but you sound like you kmow what
you’re talking about! Thаnks https://Kec-Angsana.Tanahbumbukab.Go.id/diapet/?nangis=jamuslot
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across.儿童色情
Great post thank you. Hello Administ . 国产线播放免费人成视频播放
Thank you for great information. Hello Administ . 国产线播放免费人成视频播放
I really love to read such an excellent article. Helpful article. Hello Administ . 国产线播放免费人成视频播放
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me.兒童色情
Thank you for content. Area rugs and online home decor store. Hello Administ . 国产线播放免费人成视频播放
Thank you great post. Hello Administ .国产线播放免费人成视频播放
After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader.儿童色情片
Good info. Lucky me I reach on your website by accident, I bookmarked it. 現場兒童色情片
Nice article inspiring thanks. Hello Administ . 国产线播放免费人成视频播放
Everything is very open and very clear explanation of issues. was truly information.活婴儿色情片
https://www.jp-dolls.com/
Thank you great posting about essential oil. Hello Administ . 国产线播放免费人成视频播放
Thank you for great content. Hello Administ. 国产线播放免费人成视频播放
Tebrikler, içerikleriniz gerçekten bilgilendirici.
Hi, could you please review and approve my blog post? Wishing you a productive day.
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across.
Sitenizde gezinmek keyifliydi, teşekkürler.
Hi there, I’m kindly requesting you to review and publish my blog post. Waiting for your feedback.
Would you look at the beauty of sharing? hey. very nice thing thank you
https://lisaklug.com/interfaithvoices/
Thank you for great article. Hello Administ .国产线播放免费人成视频播放
Would you look at the beauty of sharing? hey. very useful to me thank you
https://puntofisso.net/oldtechblog/index.php/2011/01/06/this-blog-in-a-cloud/?unapproved=44603&moderation-hash=e1de6815d911c88cc16b6a7973d2e392
Everything is very open and very clear explanation of issues. was truly information.
İçeriklerinizin kalitesi beni etkiledi, teşekkür ederim.
Hello, could you please review my blog post and approve it for publication? Thanks.
İçerikleriniz gerçekten kaliteli, tebrikler.
İçeriklerinizi sevdim, devamını bekliyorum.
Sitenizdeki bilgiler için teşekkür ederim.
Hi there, I kindly request you to review and publish my blog post. Thank you!
Hi there, I’m submitting my blog post for your review and approval. Appreciate your help.
Hello, I’m submitting my blog post for your review and approval. Looking forward to your feedback.
Hello, I’d appreciate it if you could review and approve my blog post. Thanks a lot.
Hi, I’m submitting my blog post for your review and approval. Wishing you a great day.
Hi, could you please review my blog post and approve it for publication? Wishing you a productive day.
Teşekkürler, içerikleriniz çok bilgilendirici.
Good day, could you please review my blog post and approve it for publication? Thanks.
İçerikleriniz beni etkiledi, teşekkürler.
Hi, I’m kindly requesting you to review and publish my blog post. Looking forward to your response.
Harika içerikler, tebrikler.
After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader.
Hello, I’d appreciate it if you could review and approve my blog post. Thank you.
Good info. Lucky me I reach on your website by accident, I bookmarked it.
Sitenizin içerikleri gerçekten değerli.
Thank you for great content. Hello Administ.
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me.
İçeriklerinizle ilgili olumlu bir geri bildirimde bulunmak istedim.
Sitenizdeki içerikler için tebrikler, devamını dilerim.
Sitenizdeki bilgiler benim için çok değerli.
Good day, could you please review my blog post and approve it for publication? Thank you.
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across.
https://www.jp-dolls.com/
https://www.jp-dolls.com/
https://www.riarudoll.com/realdoll-oshiri.html
Good day, I kindly request you to review and approve my blog post. Looking forward to your response.
https://www.jp-dolls.com/
https://www.jp-dolls.com
Merhaba, sitenizdeki içerikler harika!
Hi there, I’m requesting you to review and publish my blog post. Thanks in advance for your feedback.
Sitenizin içeriği ve tasarımı çok başarılı.
İçerikleriniz beni etkiledi, teşekkürler.
we’re thrilled to introduce you to definitely the most up-to-date innovation in intercourse doll technological innovation the new STPE material, a short while ago launched by WM Dolls.
https://www.kireidoll.com/
https://www.jp-dolls.com/
Harika site, içeriklerinize bayıldım!
Good day, I’m submitting my blog post for your consideration. Appreciate your valuable feedback in advance.
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across.儿童色情
Emeğinize sağlık, içerikleriniz çok değerli.
Sitenizin içerikleri benim için çok faydalı oldu.
Hello, I’d appreciate it if you could review and approve my blog post. Thank you.
I really love to read such an excellent article. Helpful article. Hello Administ . 国产线播放免费人成视频播放
Sitenizin tasarımı ve içerikleri çok başarılı!
Hello, I’m submitting my blog post for your consideration. Appreciate your feedback.
397545 524876Housing a different movement in a genuine case or re-dialed model. 782046
https://www.jp-dolls.com/
Sitenizin içeriği ve tasarımı çok başarılı.
After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader.儿童色情片
İçeriklerinize düzenli olarak uğrayacağım, tebrikler.
Harika site, içeriklerinize bayıldım!
Thank you for content. Area rugs and online home decor store. Hello Administ . 国产线播放免费人成视频播放
Nice article inspiring thanks. Hello Administ . 国产线播放免费人成视频播放
Hello, could you please review my blog post and approve it for publication? Thanks a lot.
Thank you for great information. Hello Administ . 国产线播放免费人成视频播放
Sitenizi keşfetmek güzeldi, teşekkürler.
Good info. Lucky me I reach on your website by accident, I bookmarked it. 現場兒童色情片
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across.国产线播放免费人成视频播放
Tebrikler, içerikleriniz gerçekten bilgilendirici.
Emeğinize sağlık, içerikleriniz çok değerli.
Everything is very open and very clear explanation of issues. was truly information.活婴儿色情片
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me.兒童色情
Great post thank you. Hello Administ . 国产线播放免费人成视频播放
Thank you great posting about essential oil. Hello Administ . 国产线播放免费人成视频播放
Thank you great post. Hello Administ .国产线播放免费人成视频播放
Thank you for great content. Hello Administ. 国产线播放免费人成视频播放
Teşekkürler, içerikleriniz çok bilgilendirici.
Thank you for great article. Hello Administ .国产线播放免费人成视频播放
Hello, I kindly request you to review and publish my blog post. Thank you for your time.
Sitenizin içeriklerini beğendim, devamını dilerim.
Hello, I kindly request you to review and publish my blog post. Thank you for your time.
Sitenizin içerikleri benim için çok faydalı oldu.
Sitenizde gezinmek keyifliydi, teşekkürler.
İçerikleriniz ilgimi çekti, tebrikler.
İçeriklerinizle ilgili olumlu bir geri bildirimde bulunmak istedim.
Hi there, I’m submitting my blog post for your review and approval. Appreciate your assistance.
Sitenizdeki bilgiler için teşekkür ederim.