Tech

PowerShell Get-Ad Group Member

Hi

Can anyone please assist me on below script that I was using. I am able to extract the information of the users. The issue is it does not give the details if the user belongs to a different domain which is added on the group. Can anyone please point me what should I be doing to extract the information even if the user belongs to a different domain.

below is the script I manage so far:

Get-ADGroup "Group Members" | Get-ADGroupMember -Recursive | Get-ADUser -Properties * |
Select @{Name="Name";Expression={$_.DisplayName}},
@{Name="User ID";Expression={$_.SamAccountName}},
@{Name="WWID";Expression={$_.EmployeeID}},
@{Name="Designation";Expression={$_.Title}},
@{Name="Email";Expression={$_.EmailAddress}} |
Export-CSV C:\Users\Users\Desktop\Group-Members.csv -NoTypeInformation

Thanks in advance

Get-ADPrincipalGroupMembership will do this.

Get-ADPrincipalGroupMembership username | select name

name
----
Domain Users
Domain Computers
Workstation Admins
Company Users
Company Developers
AutomatedProcessingTeam
1 Like