Hi
I am running below PS command to get the users details of all users which are in groups.csv file with their attributes.
Import-Csv .\groups.csv | % { Get-ADGroupMember $_.group | Get-ADUser -Properties * | select name,SamAccountName,enabled,title,department,@{l='Manager';e={$_.manager -replace 'CN=(.+?),OU=.+','$1'}}} | Export-Csv users.csv -NoTypeInformation -Encoding UTF8
I have got desired result as well.
But I need to segregate all users to belong their groups which mentioned in group.csv file. Also can i export users of groups in csv files each new sheet with group name?
In other way,
Is this possible that i have around 200 groups name and i want to export group's users with their attribute (user’s name, SamAccountname, status, title, department and their manager’s name/SamAccoutName) in individual csv file
I am running below PS command to get the users details of all users which are in groups.csv file with their attributes.
Import-Csv .\groups.csv | % { Get-ADGroupMember $_.group | Get-ADUser -Properties * | select name,SamAccountName,enabled,title,department,@{l='Manager';e={$_.manager -replace 'CN=(.+?),OU=.+','$1'}}} | Export-Csv users.csv -NoTypeInformation -Encoding UTF8
I have got desired result as well.
But I need to segregate all users to belong their groups which mentioned in group.csv file. Also can i export users of groups in csv files each new sheet with group name?
In other way,
Is this possible that i have around 200 groups name and i want to export group's users with their attribute (user’s name, SamAccountname, status, title, department and their manager’s name/SamAccoutName) in individual csv file