PowerShell Command to run on your Windows 2008 R2 DC’s to prevent accidental deletion of objects on a specific OU

By |2017-12-08T14:24:48+00:00May 25th, 2012|PowerShell, Windows|0 Comments

Here is a quick command you can run to protect an OU’s objects.

In this Example the OU we’re protecting is “OU=Users,OU=Test,DC=Test,DC=com”

Get-ADobject -Filter * -SearchBase "OU=Users,OU=Test,DC=Test,DC=com" | Set-adobject -ProtectedFromAccidentalDeletion $true

Now all the objects in the OU will be protected.


Leave A Comment

like what you see? 

Sign-up to our newsletter and never miss out on the latest blogs, events and tech news from the world of risual
Give it a try, you can unsubscribe anytime.