syntax error

Anonymous
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 for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Answer accepted by question author
  1. Young Yang (Shanghai Wicresoft Co,.Ltd.) 661 Reputation points
    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. Viktor Dronov 146 Reputation points
    2020-07-16T06:11:47.647+00:00

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


  2. Viktor Dronov 146 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' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.