Adding Members to Static Groups
Adding Members to Static Groups
Members can be added to Static Groups by invoking the cmdlet Add-EmdbGroupMember or by invoking the method AddMember() of the group object.
Examples:
Hint: The execution of these examples requires a connected PowerShell drive. |
Add the Computer "XP01" as a member to 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" Add-EmdbGroupMember -Group $MyGroup -Member $MyComputer |
Alternatively add the Computer "XP01" as a member to the Static Group "WinZip 12" in the Domain "solys.local" by invoking the method AddMember():
$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.AddMember($MyComputer) |
Add the Computer "XP01" from the Organizational Unit "Chicago\ITService\Workstations" as a member to the Static Computer Group"Admin-Laptops". The group itself is an object in the context "Chicago\ITGlobal\Workstations", that is different from the context of the Computer "XP01":
$MyGroup = Get-EmdbGroup "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITGlobal\Workstations\Admin-Laptops" $MyComputer = Get-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\XP01" Add-EmdbGroupMember -Group $MyGroup -Member $MyComputer |
Alternatively add the Computer "XP01" from the Organizational Unit "Chicago\ITService\Workstations" as a member to the Static Computer Group"Admin-Laptops". The group itself is an object in the context "Chicago\ITGlobal\Workstations", that is different from the context of the Computer "XP01" by invoking the method AddMember():
$MyGroup = Get-EmdbGroup "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITGlobal\Workstations\Admin-Laptops" $MyComputer = Get-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\XP01" $MyGroup.AddMember($MyComputer) |