Remove-AD Cmdlet
Deletes Microsoft Active Directory data.
Syntax
Remove-AD [parameters]
Remarks
The Remove-AD cmdlet allows you to use a syntax similar to SQL DELETE statements to delete Microsoft Active Directory data.
$conn = Connect-AD -User 'MyUserName' -Password 'MyPassword' -Server 'MyServer' -Port 'MyPort' -BaseDN 'MyDN' Remove-AD -Connection $conn -Table "User" -Id "CN=User Name,CN=Users,DC=Domain"The Where parameter can also be used to specify the primary key:
Remove-AD -Connection $conn -Table "exTablePowershell;" -Where "Id = CN=User Name,CN=Users,DC=Domain"The primary key can also be passed to the cmdlet along the pipeline:
Select-AD -Connection $conn -Table User -Where "CN = 'Administrator'" | Remove-AD