Quantcast
Viewing all articles
Browse latest Browse all 10

Answer by Keith Hill for Use -notlike to filter out multiple strings in PowerShell

I think Peter has the right idea. I would use a regular expression for this along with the -notmatch operator.

Get-EventLog Security | ?{$_.Username -notmatch '^user1$|^.*user$'}

Viewing all articles
Browse latest Browse all 10

Trending Articles