I've just created a nice little script that deals with that in a manner that I think is appropriate.
Import-Module ActiveDirectoryI've specify the OU where my custom security groups are, otherwise I would be exporting groups like Domain Computers.
$ou = Read-Host -Prompt 'Specify Organizational Unit here'
Get-ADGroup -filter {GroupCategory -eq "Security"} -SearchBase $ou | ForEach-Object {
$group = $_.SamAccountName
$saveto = $("C:\temp\" + $_.Name + ".csv")
Get-ADGroupMember -identity $group -recursive | select Name | Export-Csv $saveto
}
This creates a CSV file for each individual security group, with the same name as the security group.
Hope this helps someone who is looking for the same solution.
No comments:
Post a Comment