通配符搜索-Filter

时间:2017-10-04 04:44:28

标签: powershell filter

希望更好地了解过滤器选项,例如

这产生了正确的结果

Get-WmiObject -Class Win32_Service -Filter "Name = 'vss'"

如何在过滤器内部进行通配符搜索,而不将其连接到where条件,如:

Get-WmiObject -Class Win32_Service -Filter "Name='v*'"

Get-WmiObject -Class Win32_Service -Filter "Name='*v*'"

Get-WmiObject -Class Win32_Service -Filter "Name='v'"

Get-WmiObject -Class Win32_Service -Filter "Name like 'v*'"

1 个答案:

答案 0 :(得分:5)

Get-WmiObject -Class Win32_Service -Filter "name LIKE 'vss%'"

它使用WQL进行过滤(%是通配符)

最终以

运行
Get-WmiObject -Query "Select * From win32_service Where name Like 'vss%'"
相关问题