Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wildcard Search in -Filter

Want to have a better understanding of filter option like

This is yielding proper result

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

How to have a wildcard search inside the filter without piping it to the where condition like :

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*'"
like image 949
Ranadip Dutta Avatar asked Mar 08 '23 21:03

Ranadip Dutta


1 Answers

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

It uses WQL for the filtering (% is wildcard)

Which ends up being run as

Get-WmiObject -Query "Select * From win32_service Where name Like 'vss%'"
like image 125
the_sw Avatar answered Mar 11 '23 02:03

the_sw