Is the following syntax correct because the code is not skipping as it should.
foreach($acc in get-SPmanagedAccount)
{
$accNamewithDomain = $acc.UserName
$accname = $accNamewithDomain.Split("\")[1]
if(($accName -ne "svc-reader-tst") -or ($accName -ne "svc-writer-tst"))
{
# do somthing
}
}
1 Answer
I updated the code with -and operator per Arnavion and it's working as expected.
foreach($acc in get-SPmanagedAccount)
{
$accNamewithDomain = $acc.UserName
$accname = $accNamewithDomain.Split("\")[1]
if(($accName -ne "svc-reader-tst") -and ($accName -ne "svc-writer-tst"))
{
# do somthing
}
}