Use -notlike to filter out multiple strings in PowerShell

后端 未结 9 501
执念已碎
执念已碎 2020-12-14 15:58

I\'m trying to read the event log for a security audit for all users except two, but is it possible to do that with the -notlike operator?

It\'s somethi

9条回答
  •  借酒劲吻你
    2020-12-14 16:15

    don't use -notLike, -notMatch with Regular-Expression works in one line:

    Get-MailBoxPermission -id newsletter | ? {$_.User -NotMatch "NT-AUTORIT.*|.*-Admins|.*Administrators|.*Manage.*"}
    

提交回复
热议问题