GroupMemberShip

by Mar 6, 2014

Hello,

I am able to find/list the AD user's groupmembership with this little function:

function Get-GroupMembership
{  
    param(
        $UserName = $env:username,      
        $Domain = $env:userdomain   
    )
     $user = Get-WmiObject -Class Win32_UserAccount -Filter "Name='$UserName' and Domain='$Domain'"
    $user.GetRelated('Win32_Group')
}

But I would like modify/add new memberships, handy hints would be appreciated.