Hey,
I'm trying to see if a string startswith a or b or c or d or f or g.. yeah.. basically a-g. Is that possible using this method?
$All = Get-ADGroupMember Groupname | select samaccountname
Foreach ($User in $All)
{
If ($user.name.startswith("A"))
{"This works"
}
}
######### This is what I want..: (but it doesnt work)
$All = Get-ADGroupMember Groupname | select samaccountname
Foreach ($User in $All)
{
If ($user.name.startswith("A-G"))
{"This works"
}
}# This works, but it should not be necessary
If (($user.name.startswith("a")) -or ($user.name.startswith("b"))) {"This works"}