Removing Static Groups

Removes the specified Static Group(s).


Examples:


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


Remove the Static Computer Group "Admin-Notebooks" from the context "solys.local\Chicago\ITService\Workstations":


Remove-EmdbGroup "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\Admin-Notebooks"


Remove the Static Computer Group "Admin-Notebooks" in the current context:


Cd "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations"

Remove-EmdbGroup "Admin-Notebooks"


As an alternative method, the following shows the removing of the Static Computer Group "Admin-Notebooks" from the context "solys.local\Chicago\ITService\Workstations" using the Delete()-method:


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

$MyGroup.Delete()


Remove the Static Computer Group"Admin-Workstations" from the context "solys.local\Chicago\ITService\Workstations" using the cmdlet Remove-Item:


Remove-Item "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\Admin-Workstations"


Hint: Alternatively the alias DEL can be used to remove Static Group objects.


Starting with PSX 3.1 there was a new option implemented when deleting Group objects. When specifying the SingleItemExpected-switch it is expected, that none or exactly one object is affected. If the command would delete more than one object, an error is raised that can be caught and handled in scripts.