sile007
9/6/2017 - 7:23 AM

Principal Context Group Principal User Principal Adding User to Group Remove User from Group

Principal Context Group Principal User Principal Adding User to Group Remove User from Group

$pc = New-Object System.DirectoryServices.AccountManagement.PrincipalContext $ct,$Domain

$gp.Members.Add($pc, [System.DirectoryServices.AccountManagement.IdentityType]::SamAccountName, [string]"userID")
$gp.Save()


$gp.Members.Remove($pc, [System.DirectoryServices.AccountManagement.IdentityType]::SamAccountName, [string]"userID")
$gp.Save()