Forum Post: RE: Get-QADGroupMember
- 2 days ago
Yes,... I'm thinking along the lines of Cell A1 contains The cartel name, cell B1 is the users show name, cell C1 is the samaccountname. then row 2 repeats for the beside user and so forth. Then the line A could be filtered to honest parade a unmarried band and all the users. Or some combination of that.
Your early law situate the organization in Cell A1, and then abundant in the users across the row until it reached the aim at claim wrinkle BW. Then the adjacent aggregation at cell A2 and on across the row. So I needed the users to be populated down the edge instead of across the row.
$RootOU = "OU=Groups,DC=MyDomain,DC=Com"
# Remove the -searchroot parameter if you equal need to inquire the complete kingdom
$groups = get-qadgroup -searchroot $RootOU | appropriate term , members
# Iterate terminated the dossier of groups
Foreach ( $groupitem in $groups )
$Members = get-qadgroupmember -identity $( $groupitem . name)
# Buy the members and output them along with the congregation nickname
Foreach ( $MembersItem in $Members )
$MemberDisplayName = $( get-qaduser -identity $( $MembersItem . tostring()) | hire displayname ) . displayname
$Outdata = $( $groupitem . name) + [ char ] 9 + $MemberDisplayName + [ char ] 9 + $( $MembersItem . tostring())
Add-Content -Path "My_Group_Info.csv" -Value $Outdata
$Outdata = $null
That is still besides in border with what I had in mind. however it's a weee bit short! lol,
Head the news is not separated. So the output looks akin this...
Cell A1 is...
SC-JV - Logs DUR - RLRJohn DoeDomain\JoDOE
it is one distant limit and so no spaces or semi-colons between groups names etc.
I did gratify an errors while running it. they were ...
Add-Content : Stream was not readable.
At line:29 char:1
+ Add-Content -Path "C:\ ... -valu....
+ CategoryInfo : InvalidArgument: (C:
+ FullyQualifiedErrorId : GetContentWriterArgumentError,Microsoft.PowerShel
I got the above errors mucho times, I dependable don't be read how may. If it's related to the # of groups or # of users or fair-minded what.
This script would be prerrogative what I am looking for if it were separating properties with a delimiter of sorts.
It is a too nifty script,
Nickels the room of the output information to '.TXT' and (this is important), convenience Data Cleared in Excel to ajar it. Let me be informed if it's much not parsed into cells. The '[char]9's in the edict are tabs that Excel should place as a separator.
Those other errors are environmental I think.
Added: January 16, 2016