Site icon Franky's Web

AD: Protect all OUs of the organization from accidental deletion

The Best Practice Analyzer issues a warning if not all organizational units (OUs) of the organization are protected against accidental deletion. If you don't want to go to the trouble of clicking on all OUs individually and activating the protection, you can let Powershell do the work for you.

On the Powershell, we first import the Active Directory module:

Import-module activedirectory

Dann setzen wir für alle OUs den Parameter „ProtectedFromAccidentalDeletion“:

Get-ADOrganizationalUnit -Filter {Name -like „*“} | Set-ADOrganizationalUnit -ProtectedFromAccidentalDeletion $true

Depending on how many OUs there are in the organization, it may take some time to execute the command.

Exit mobile version