How to test from group membership with Powershell
Posted on 2010-04-01
I am using the Quest AD tool in conjuction with powershell to remove users from a group, I need a way to quickly check if a user belongs to the group before issuing the instruction to remove the user from the group.
I need something to return a boolean ideally, in VB you can use ISMember I think, all the powershell examples I have found so far enumerates the group and check if the user is a member, this method will slow my script down big time. If there's nothing that can do it natively in powershell perhaps accessing .NET object via powershell..
Thanks in advance