Advertisement
goezler

Disable ProtectedFromAccidentalDeletion

Apr 21st, 2023
1,029
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $Computers = get-content C:\install\OUs_zu_löschen.txt
  2. ForEach ($Computer In $Computers) {
  3.  
  4.     $DN = Get-ADObject -Filter "DistinguishedName -eq '$computer'"
  5.     If ($DN) {#Set-ADObject -Identity $DN -ProtectedFromAccidentalDeletion $True
  6.         $DN | Set-ADObject -ProtectedFromAccidentalDeletion $false
  7.         $DN | Remove-AdObject -Confirm
  8.  
  9.  
  10.  
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement