I have some code that takes in a string,
Foreach($user in $allUsers){
if($user.DisplayName.ToLower().Contains("example.com") -or $user.DisplayName.ToLower()) {
} else {
$output3 = $externalUsers.Rows.Add($user.DisplayName)
}
}
Part of the if right after the -or I need to check if the string does not contain an @ sign. How can I check to see if the @ sign is missing?
.Contains()returns a boolean. Just check for!($user.DisplayName.ToLower().Contains("@"))?