WQL学习 taro Posted on Apr 5 2021 windows WMI WQL ## 定义 WQL是用于获取PowerShell中的WMI(Windows Management Instrumentation)对象的WMI查询语言(WQL)。 WQL 查询比标准 Get-WmiObject 命令要快一些,而且在数百个系统上运行命令时,性能得到了改善。 ```powershell Get-WmiObject -Query {Select * from Win32_Process where Name = 'Notepad.exe'} Get-CimInstance -Query "Select * from CIM_Process where Name = 'Notepad.exe'" ``` >使用 “Get-CimInstance -Query” 的时候,后面的 WQL查询语句,不要用{},需要用""括起来,否则会报错。 注:使用 { }括起来的时候被作为脚本块解析了,脚本块中的 WQL没有输入。 WQL查询语言中Where语句中有效的运算符: | Operator | Description | | ---- | ---- | |= | Equal| |!=| Not equal| |<> | Not equal| |< | Less than| |> | Greater than| | <= | Less than or equal| | \>= | Greater than or equal| |LIKE | Wildcard match| |IS | Evaluates null| |ISNOT | Evaluates not null| |ISA | Evaluates a member of a WMI class| ## 测试工具 ### wbemtest  >https://developer.aliyun.com/article/403245 Kernel Connector(翻译) WMI学习