Removing Active Directory Groups
Removing Active Directory Groups
Remove the specified External Group objects.
Examples:
Hint: The execution of these examples requires a connected PowerShell drive. |
Remove the External Group object "Guests" from the context "solys.local\Builtin":
Remove-EmdbGroup "emdb:\rootDSE\Managed Users & Computers\solys.local\Builtin\Guests" |
Remove the External Group object "Guests" in the current context:
Cd "emdb:\rootDSE\Managed Users & Computers\solys.local\Builtin" Remove-EmdbGroup "Guests" |
As an alternative method, the following shows the removing of the External Group object "Guests" using the Delete()-method:
$MyGroup = Get-EmdbGroup "emdb:\rootDSE\Managed Users & Computers\solys.local\Builtin\Guests" $MyGroup.Delete() |
Remove the External Group object "Guests" using the cmdlet Remove-Item:
Remove-Item "emdb:\rootDSE\Managed Users & Computers\solys.local\Builtin\Guests" |
Hint: Alternatively the alias DEL can be used to remove External 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.