$user1=read-host"Enter the users Login ID"
$GetData=Get-ADPrincipalGroupMembership$user1 | Select-Object-ExpandProperty name
$GetData
The code above works fine when I enter a valid users active directory login ID. But if I enter a bad user name like 'MrBadUser' it returns all the groups that my ID is a member of. Why?
Thank you.