mercredi 24 avril 2019

Powershell multiple If-Statements with loop

I have to check for multiple array entries in an if statement.

if (($Right.IdentityReference -eq $User) -or ($Right.IdentityReference -eq ("Domain\" + $GroupArrayList[0])) -or ($Right.IdentityReference -eq ("Domain\" + $GroupArrayList[1])))

This will continue with $GroupArrayList[2], $GroupArrayList[3], ...

Is there any way how I can go trough every entry of the array? I can't write every position down because the array size is dynamic. How can I create such a loop?

Aucun commentaire:

Enregistrer un commentaire