Removing Members from Static Groups

Members can be removed from Static Groups by invoking the cmdlet Remove-EmdbGroupMember or by invoking the method RemoveMember()of the group object.

Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


Remove the Computer "XP01" from the Static Group "WinZip 12" in the Domain "solys.local":


$MyGroup = Get-EmdbGroup "emdb:\rootDSE\Managed Users & Computers\solys.local\WinZip 12" -SchemaTag "Group"

$MyComputer = Get-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\XP01"

Remove-EmdbGroupMember -Group $MyGroup -Member $MyComputer


Alternatively remove the Computer "XP01" from the Static Group "WinZip 12" in the Domain "solys.local" by invoking the method RemoveMember():


$MyGroup = Get-EmdbGroup "emdb:\rootDSE\Managed Users & Computers\solys.local\WinZip 12" -SchemaTag "Group"

$MyComputer = Get-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\XP01"

$MyGroup.RemoveMember($MyComputer)


Remove the User "Adam Sam" from the Organizational Unit "Chicago\ITService\Users" from the Static User Group "Chicago\ITService\Admins":


$MyGroup = Get-EmdbGroup "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Users\Admins"

$MyUser = Get-EmdbUser "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Users\Adam Sam"

Remove-EmdbGroupMember -Grouop $MyGroup -Member $MyUser


Alternatively remove the User "Adam Sam" from the Organizational Unit "Chicago\ITService\Users" from the Static User Group "Chicago\ITService\Admins" by invoking the method RemoveMember():


$MyGroup = Get-EmdbGroup "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Users\Admins"

$MyUser = Get-EmdbUser "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Users\Adam Sam"

$MyGroup.RemoveMember($MyUser)