Filter AD-Users by length of the string for samaccountname
I am trying to create a query with Dynamic groups. I only want records where the samaccountname length is 6 (string is 6 characters long). I cannot find a method to do it. Is this not possible? In PowerShell, it could be done with a where statement. In this case I use name instead of samaccountname, but it is the same idea.
get-aduser -filter {name -like '*'} | Where {$_.name.length -gt 6}
Please sign in to leave a comment.
Comments
1 comment