syntax error

Ian Xue 37,536 Reputation points Microsoft Vendor
2020-07-16T03:14:56.707+00:00

Hi All i am using the below query but still i am getting in output IT manager which i am not supposed to, experts guide me

12588-2020-07-16-111337.png

https://social.technet.microsoft.com/Forums/windowsserver/en-US/3f8d6b17-7aae-48b9-958d-5262c0a309d7/syntax-error?forum=winserverDS#32901fa5-f2b9-471f-afeb-327879527c1a

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,544 questions
0 comments No comments
{count} votes

Accepted answer
  1. 2020-07-16T06:03:53.123+00:00

    Hi,

    Thanks for your question.

    ((description -notlike 'System Administrator') -or (description -notlike 'IT Manager'))

    You need to replace the "-or" with "-and".

    If you use "-or", it will only match one of two conditions.

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_logical_operators?view=powershell-7

    Best regards,

    Young Yang

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Vector BCO 131 Reputation points
    2020-07-16T06:11:47.647+00:00

    what the reasone for this fake discussion?
    question was solved long time ago


  2. Vector BCO 131 Reputation points
    2020-07-16T07:01:18.177+00:00

    YoungYang, is the any plans for migration Technet/MSDN topics here? Many disscussions is only one unique place where can be found solutions for odd problems
    So if forum will be just turned off lots of them will be lost


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.