Techieshelp.com

Stop OU`s from being deleted

IT Tutorials

Problem

Everyone has seen users ,groups OU`s being  deleted accidentally from active directory, luckily we can now stop OU`s from being deleted by accidently. Follow the step by step guide below to stop this happening.

Resolution

This can be done two ways, both simple, one from power shell and one from active directory users and computers.

1.) The power shell Method. First fire up power shell. Then enter the commands below.

Get-ADOrganizationalUnit -filter * -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion -eq $false} | Set-ADOrganizationalUnit -ProtectedFromAccidentalDeletion $true

2) To check what OU`s are NOT protected enter..

Get-ADOrganizationalUnit -filter * -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion -eq $false} | ft

3) If you would like to do this to just an individual, go into active directory users and computers, Select the OU, right click it, go to object and put a tick in “protect from accidental deletion”.