Removing Dynamic Groups

Removes the specified Dynamic Group(s).


Examples:


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


Remove the Dynamic Computer Group "Dell-Laptops" from the context "solys.local\Chicago\ITService\Workstations" using the method Delete():


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

$MyGroup.Delete()


Remove the Dynamic Computer Group "Lenovo-Desktops" 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\Lenovo-Desktops"


Hint: Alternatively the alias DEL can be used to remove Dynamic 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.