什么是WMIC
WMI的全名为“Windows Management Instrumentation”。从Windows 98开始,Windows操作系统都支持WMI。WMI是由一系列工具集组成的,可以在本地或者远程管理计算机系统。
常规用法
进程与服务
- 获取系统进程信息
【brief摘要信息,full全部信息】
wmic process list brief/full
#获取指定信息
wmic process get [属性]
#wmic process get processid,name,executablepath
- 创建/删除 进程
wmic process call create/delete “[Process Name]”
#e.g
#wmic process call create calc (创建计算机进程,打开计算器)
wmic process call create "FilePath"
#wmic process call create "C:\windows\system32\cmd.exe "(打开某一个路径的程序,杀软拦截的比较狠)
- 终止进程
wmic process where name=”explorer.exe” call terminate
- 查詢服务信息
wmic service list brief
#查看运行中的服务
wmic service where "state='running'" list brief
- 开启/关闭服务
#开去服务
wmic service where "name='【SERVERNAME】'" call startservice
#关闭服务
wmic service where "name='【SERVERNAME】'" call stopservice
系统应用程序
- 查看安装的软件信息
wmic product get name,version
文件管理
- 获取可执行文件列表
wmic process where "NOT ExecutablePath LIKE '%Windows%'" GET ExecutablePath
- 获取目录属性
wmic fsdir where "drive='【盘符】:' and filename='【目录名】'" get /format:list
#wmic fsdir where "drive='f:' and filename='kk'" get /format:list
- 删除目录
wmic fsdir where "[盘符]:\\[目录名]" call delete
#使用双斜杆转义
#wmic fsdir where "f:\\test" call delete
用户账号管理
- 用户信息获取
wmic useraccount
wmic useraccount list brief
- 用户账号重命名
wmic useraccount where "name='%UserName%'" call rename newUserName // 更改当前用户名
wmic useraccount where "name='Administrator'" call Rename admin // 更改指定用户名
其他
- 以文件的形式输出获取的内容
wmic /output:d:\install.txt product get name,version
WMIC之信息收集
获取系统角色、用户名和制造商
wmic computersystem get Name,Domain,M
本文详细介绍了Windows Management Instrumentation Command-line (WMIC) 和 PowerShell的Get-CimInstance命令的使用,包括进程和服务管理、系统信息收集、内网横移等操作,适用于系统管理员和红队成员进行系统管理和信息获取。
最低0.47元/天 解锁文章
898

被折叠的 条评论
为什么被折叠?



