Quick Powershell script to protect all OUs from acidental delition.
Run the following script from the Active Directory Module to finda all unprotected OUS
Get-ADOrganizationalUnit -filter * -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion -eq $false} | ft
Run the following script from the Active Directory Module to protect all the OUs listed in output from obove scripts.
Get-ADOrganizationalUnit -filter * -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion -eq $false} | Set-ADOrganizationalUnit -ProtectedFromAccidentalDeletion $true
TechNet Article
No comments:
Post a Comment