Powershell Select-String -pattern -notMatch Powershell Select-String -pattern -notMatch powershell powershell

Powershell Select-String -pattern -notMatch


Like this?

$LocalAdmins | select-string -Pattern 'Administrator|daemon' -NotMatch | select -expa line

-pattern accepts REGEX. You can use the | ( or regex operator ) to add others words to fit your needs.


Assuming that $LocalAdmins is an array you could do this:

$exclude = 'Administrator', 'Domain-Administrator', 'daemon'$LocalAdmins | Where-Object { $exclude -notcontains $_ }