What I would like to do is exclude preferred names in a web query in single command. For example, now if I want to exclude some system accounts or user names that are named John and Edward and other I am putting a query like this: {searchboxquery} contentclass=spspeople -e-mail: *.no -accountname:-*Adm* -*lync* -PreferredName:"John*" -PreferredName:"Edward*"-PreferredName:"Gregor*" -PreferredName:"Joseph*" -PreferredName:"User*" etc. etc. Everytime I need to add -PreferredName How to avoid this?

How to select multiple words to exclude just by separating them with comma or other separator? I tried -PreferredName:"John*" , "Edward*" ,"Joseph*" but it does not work. Any help?

  • I am not sure why you reffering to powershell at all. Is a web query also a powershell command?. The query I am testing is a webpart query text, available after edit Webpart, and change query option. I added more code in original question. – Sławomir Nov 21 '18 at 8:36
  • Sorry, my mistake. – helb Nov 21 '18 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.