Hi Everyone,
I need some assistance as I am a bit new at powershell. I wrote a command that will get multiple AD security groups located within a text file, which will then get the users of each group and export the .csv.
The problem is that the end user would like the report to include the description of each group as I have listed the name of each group for each user/member line in the report. The description presented in the file is the "Description" of the AD user object and not of the group.
Columns of CSV file.
Group Name | Name | Domain | Description | NTAccountName
For some reason I can't figure out how to include this attribute on the security group to include on the report. I can get it if I run the below command by itself,
Get-QADGroup -Identity "ADGroupName" -Service "machineIP" -Credential $admincreds.domain | select Description
but can't get it in the script line I have written for this.
Script Line:
Get-Content 'textfile.txt' | ForEach-Oject {$group=$_;Get-QADGroupMember $_ -Service 'machineIP' -Credential $admincreds.domain} | select @{n='groupname' ;e={$group}}, name,domain,description,NTAccountName | Export-Csv "OutputFilePath"
Final Result;
Group Name | Group Description | Name | Domain | Description | NTAccountName