I've been tasked with exporting the members of a few AD groups to .csv
which I've always done in the past using the Get-ADGroupMember
command in powershell, specifying the group name, selecting the property I need, and using export-csv
.
I seem to run into an issue with one group though which appears to be related to the fact that the AD group has members that belong to an external domain in a different forest. Essentially I run the following command below, but the output file comes out blank.
Get-ADGroupMember -identity "VPN Users" | select name | Export-csv -path c:\vpnuserslist.csv -NoTypeInformation
The output is the following:
PS C:\Windows> Get-ADGroupMember -identity "VPN Users" | select name | Export-Csv -Path c:\vpnuserstest.csv -NoTypeInformation
Get-ADGroupMember : The operation completed successfully
At line:1 char:18
+ Get-ADGroupMember <<<< -identity "VPN Users" | select name | Export-Csv -Path c:\vpnuserstest.csv -NoTypeInformation
+ CategoryInfo : NotSpecified: (VPN Users:ADGroup) [Get-ADGroupMember], ADException
+ FullyQualifiedErrorId : The operation completed successfully,Microsoft.ActiveDirectory.Management.Commands.GetADGroupMember
I also noticed that when going to the group in Active Directory Users and Computers, I receive a message:
Active Directory Domain Services
Some of the object names cannot be shown in their user-friendly form. This can happen if the object is from an external domain and that domain is not available to translate the object's name.
Is there any way I can get the members successfully exported, regardless of if a few names aren't formatted properly, etc...? Thanks in advance for the help!