xxxxxxxxxx
Note: You need to run this command with sufficient privileges to unprotect the
OU from the Active Directory.
// To unprotect the OU
Set-ADObject -ProtectedFromAccidentalDeletion:$false -Identity "OU=Protected_OU,DC=Domain,DC=com" -PassThru -Confirm:$false
// To Delete the OU
Remove-ADOrganizationalUnit -Identity "OU=OU_Name,DC=domain,DC=com" -confirm:$false
// You can also Target a specific OU then Unprotect it and then Delete it
// Here is the combined CMD
Get-ADOrganizationalUnit -Identity 'OU=Avengers,DC=savilltech,DC=net' | Set-ADObject -ProtectedFromAccidentalDeletion:$false -PassThru | Remove-ADOrganizationalUnit -Confirm:$fals