Protecting OU objects from accidental deletion in Active Directory

Get-ADOrganizationalUnit -filter * | Set-ADOrganizationalUnit -ProtectedFromAccidentalDeletion $true
This Powershell command gets a list of all organizational units in Active Directory and sets “ProtectedFromAccidentalDeletion” on them. To remove this attribute from your OU’s you can end the script with $false

Leave a Reply

Your email address will not be published. Required fields are marked *