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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome...I knew I wasn't too far off. Thank you.
https://gallery.technet.microsoft.com/scriptcenter/Get-AD-Group-Details-0e32e900