Unprotect OUs is a PowerShell script that removes accidental deletion protection from multiple Active Directory Organizational Units (OUs) at once. It supports wildcard patterns for flexible bulk operations, making it ideal for cleanup tasks or reorganization projects.
-SearchBase (Required) - The distinguished name of the parent OU to search within-OUName (Required) - The name of the OU(s) to unprotect. Supports wildcards (e.g., 'Deploy*' or '*Printer*').\\unprotectOUs.ps1 -SearchBase "OU=Workstations,OU=Computers,DC=domain,DC=local" -OUName "Deploy Printer Logic"
.\\unprotectOUs.ps1 -SearchBase "OU=Workstations,OU=Computers,DC=domain,DC=local" -OUName "Deploy*"
.\\unprotectOUs.ps1 -SearchBase "OU=Workstations,OU=Computers,DC=domain,DC=local" -OUName "*Printer*"
.\\unprotectOUs.ps1 -SearchBase "OU=Workstations,OU=Computers,DC=domain,DC=local" -OUName "*"
Searching in: OU=Workstations,OU=Computers,DC=domain,DC=local
Looking for OUs matching: Deploy*
----------------------------------------
Found 5 OU(s) matching 'Deploy*'
----------------------------------------
Processing: OU=Deploy Printers,OU=Workstations,OU=Computers,DC=domain,DC=local
Current Protection Status: True
New Protection Status: False
Processing: OU=Deploy Software,OU=Workstations,OU=Computers,DC=domain,DC=local
Current Protection Status: True
New Protection Status: False
----------------------------------------
Summary:
Total OUs found: 5
OUs unprotected: 4
Already unprotected: 1