Set all OU’s to protect from accidental Deletion
1 2 3 |
Get-ADOrganizationalUnit -filter * -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion -eq $false} | Set-ADOrganizationalUnit -ProtectedFromAccidentalDeletion $true |
Export List of Empty AD Groups to CSV
1 2 3 |
Get-ADGroup -Filter * -Properties Members | where {-not $_.members} | select Name | Export-Csv C:\Exports\EmptyGroups.csv -NoTypeInfo |