I am working on a script to add a SharePoint user policy for a claims based web application. The username has to be claims encoded, which differs for users accounts and groups. If the username is passed as
[string] $username
How can I determine if the string is a user account or a group? I have not found anything short of a brute force AD search for the username with a group filter.