Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Computers = get-content C:\install\OUs_zu_löschen.txt
- ForEach ($Computer In $Computers) {
- $DN = Get-ADObject -Filter "DistinguishedName -eq '$computer'"
- If ($DN) {#Set-ADObject -Identity $DN -ProtectedFromAccidentalDeletion $True
- $DN | Set-ADObject -ProtectedFromAccidentalDeletion $false
- $DN | Remove-AdObject -Confirm
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement