Q. How can I delete a protected Organizational Unit with PowerShell?
A. Organizational Units are protected from accidental deletion which means if you try to delete an OU it will fail using PowerShell. The solution is to first remove the protection from accidental deletion. This can be done as follows:
Get-ADOrganizationalUnit -Identity 'OU=Avengers,DC=savilltech,DC=net' | Set-ADObject -ProtectedFromAccidentalDeletion:$false -PassThru | Remove-ADOrganizationalUnit -Confirm:$false
In the code example note that first the OU is selected and that object passed to the Set-ADObject which removes the accidental deletion protection with -passthru which sends the object of the OU to the next command which performs the delete. Neat!