I try to get all Processes with starting letter w or s
Something like this:
Get-Process | Where-Object ProcessName -Match "^w.*" -or ProcessName -Match "^s.*" | Select-Object name, ID
but this doesnt work.
Since it's either one or the other, in the same position, you can use character class group ([characters]):
[characters]
Get-Process | Where-Object ProcessName -match '^[ws]' | ...
The .* at the end of either pattern is moot.
.*
2.1m questions
2.1m answers
60 comments
57.0k users