Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

GroupMemberShip

$
0
0

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.


Viewing all articles
Browse latest Browse all 8583

Trending Articles