I work in a larger globally managed company. I need to export a list of users from a particular group to a CSV file. I am using a simple command in PowerShell:
"Get-AdGroupMember -identity "group-name" | select name | Export-csv -path C:\members.csv -NoTypeInformation"
This is where the problem starts because I need to list people by their first and last name and in PowerShell after a command:
"Get-AdGroupMember -identity "group-name""
is called these people are listed by their ID number (below is an example)
name : 00022001
object class : user
SamAccountName : 00022001
In Active Directory Users and Computers, the example above (that is, person 0022001) is shown like this:
first name: Jan
Last name: Kowalski
Display name: Jan Kowalski
My question is: How to export a list of users from a group including their email addresses or first and last name instead of an ID number?
I am a beginner so please give me clear guidance on the problem.
Thank you for your help.