Groups

When you want to set a whole bunch of discriptions at once from a special OU you could automate this with powershell:

Get-ADGroup -Filter * -SearchBase "OU=Application OLD,OU=Groups OLD,OU=OLD,DC=contoso,DC=Local" | foreach {Set-ADGroup -Identity $_ -Description "* is no longer in use"}

If you want to see members from different groups in a specific OU you could run through them like this:

Get-ADGroup -Filter {NAME -like 'GG*'} -SearchBase 'OU=Application OLD,ou=Groepen Old,OU=OL
D,DC=contoso,dc=com' -Properties * | foreach {$_ | Select Name; get-adgroupmember -identity $_ | Select Name, Member
}

If you want a nice csv file from different groups with their members I wrote this little script with the help of some Internet resources:
$Groups = (Get-AdGroup -filter * | Where {$_.name -like "GroupName*"} | select name -expandproperty name)

$Table = @()

$Record = [ordered]@{
"Group Name" = ""
"Name" = ""
"Username" = ""
"Department" = ""
}

Foreach ($Group in $Groups)
{

$Arrayofmembers = Get-ADGroupMember -identity $Group  | select name,samaccountname

foreach ($Member in $Arrayofmembers)
{
$Record."Group Name" = $Group
$Record."Name" = $Member.name
$Record."UserName" = $Member.samaccountname
$Record."Department" = [string]$(get-aduser -Identity ($member.samaccountname) -Properties * | Select Company -ExpandProperty company)
$objRecord = New-Object PSObject -property $Record
$Table += $objrecord

}

}
$Table | export-csv "C:\temp\SecurityGroups.csv" -NoTypeInformation

On me
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License