Quantcast
Channel: Use -notlike to filter out multiple strings in PowerShell - Stack Overflow
Viewing all articles
Browse latest Browse all 10

Answer by Gavin Burke for Use -notlike to filter out multiple strings in PowerShell

$
0
0

Easiest way I find for multiple searches is to pipe them all (probably heavier CPU use) but for your example user:

Get-EventLog -LogName Security | where {$_.UserName -notlike "*user1"} |  where {$_.UserName -notlike "*user2"}

Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>