Link to home
Start Free TrialLog in
Avatar of Kenneth Cameron
Kenneth Cameron

asked on

Powershell Script to collect group and group members

Hi,

I am trying to create a PowerShell script to pull some info from Active Directory into a .csv format.  I am trying to get the following attributes:

- Group
-GroupType
-GroupMember.

Here is what I have so far:

Get-ADGroup -Filter {GroupCategory -eq "Security"} | ForEach-Object {
    $Group = $_
    Get-ADGroupMember -Recursive -Identity $_.name
} | Select-Object @{
    Name="GroupName"
    Expression={$Group.name}
}, Name | Export-Csv -NoType -Path C:\Security Groups.csv

I am running server 2008 R2.

Thanks.
Avatar of Satish Auti
Satish Auti
Flag of India image

ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kenneth Cameron
Kenneth Cameron

ASKER

Awesome...I knew I wasn't too far off.  Thank you.