Posted by: Andy Grogan | March 6, 2008

Small update: Powershell get-groupMembership function…

Hiya folks, I previously posted a function written in PowerShell that will derive if a user account in Active Directory is a member of a particular group.

Both the user account and the group are passed to the function as parameters – which will return either 1 or 0.

I have noticed a small error in the function (nothing major) where it might return no result at all if the group does not exist in AD, therefore I have updated the script that was part of the original post – and it can be downloaded from here:

get-groupMembership.ps1

 
 

 


Responses

  1. You should probably call it Test-GroupMembership since it is actually checking to see if a person is a member of a group and not getting a list of members in a group.

  2. Good point, especially as it could be confused with the “get-member” cmdlet – I will review it.

    But, at the time I wrote it the name made sense as I trying to confirm that an account was a member of the stated group.

    Cheers

    A


Leave a response

Your response:

Categories