# Enable Active Directory Recycle Bin
Enable-ADOptionalFeature –Identity ‘CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=vccware,DC=com’ –Scope ForestOrConfigurationSet –Target ‘vccware.com’
# Restore a single deleted user account
Get-ADObject -Filter {SamAccountName -eq "AlphaBet"} -IncludeDeletedObjects
Get-ADObject -Filter {SamAccountName -eq "AlphaBet"} -IncludeDeletedObjects | Restore-ADObject
# Check the deleted user accounts
Get-ADObject -IncludeDeletedObjects -Filter {IsDeleted -eq $True} -Properties * | Format-table Deleted,DisplayName,SamAccountName,UserPrincipalName
# Windows 2012R2 tombstone lifetime of the domain is 180 days by default
时间: 2024-10-12 16:21:35