26 June,2014 by Tom Collins
Question: How can I export Active Directory Group members? Also, if there are sub-groups , how can I get a list of members of AD group in Powershell?
Answer: To access the Active Directory through Powershell, an efficient method is to install the Active Directory Module for Powershell .
The Get-ADGroupMember module gets the Active Directory Group members
Import-Module ActiveDirectory Get-ADGroupMember -identity “Group name” | select name | Export-csv -path C:\ADGroupmembers.csv –NoTypeInformation
If there are nested groups , within the group you’re checking , then use the –recursive parameter.
The –recursive parameter will enable an iteration of all the nested groups , reporting on the members. The nested group members are added to the result list
Get-ADGroupMember -identity “Group name” -recursive | select name | Export-csv -path C:\ADGroupmembers.csv –NoTypeInformation
The above commands will look for AD groups within the current domain . If the requirement is to check in another domain in the same AD forest than you'll need to use the -server switch
Import-Module ActiveDirectory Get-ADGroupMember -identity “Group name” -server "another_domain"| select name | Export-csv -path C:\ADGroupmembers.csv –NoTypeInformation
How to get all Domain Controllers in Active Directory Forest with ...
Powershell , Excel charts and data presentation - SQL Server DBA
Powershell – adding multiple worksheets to Excel ... - SQL Server DBA
Export-CSV Powershell - SQL Server DBA
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |