.memberOF outputs an array and arrays don't play well with other types of info with just a straight select-object
I used to use Get-QadUser JDoe | Get-QADMemberOf for this type of stuff Haven't actually had to solve this problem in a while now though. On Tue, Feb 26, 2013 at 12:36 PM, Michael Leone <[email protected]> wrote: > On Tue, Feb 26, 2013 at 2:56 PM, Michael Leone <[email protected]> > wrote: > > I am unsure what I am doing wrong. I want a list of all my user > > accounts, and I want the contents of the "MemberOf" property, among > > other things. > > > > Get-QADuser -SizeLimit 0 | Select > > > givenName,LastName,DisplayName,mail,ParentContainer,SAMAccountName,homeDirectory,AccountIsDisabled,MemberOf,NestedMemberOf,AllMemberOf > > > > I sort this, and export to CSV. When I import the CSV into Excel, the > > "MemberOf", "NestedMemberOf" and "AllMemberOf" are showing as > > "System.String[]". > > > > What am I doing wrong? I want that "MemberOf" to actually list what > > groups the user is a member of. > > So here is where I am. I am trying to output into an Excel spreadsheet: > > $AllUsers = Get-QADUser -SizeLimit 0 LeoneM | Select > > givenName,LastName,DisplayName,description,mail,ParentContainer,SAMAccountName,homeDirectory,AccountIsDisabled,MemberOf,NestedMemberOf,AllMemberOf > | sort AccountIsDisabled,LastName,FirstName > > ForEach ($User in $AllUsers) > { > > $Cells.Item($CurrentRow, $CurrentCol) = $User.displayName > $CurrentCol++ > > $ListOfGroups = Get-QADMemberOf $User.sAMAccountName > $Cells.Item($CurrentRow, $CurrentCol) = $ListOfGroups > > Write-Host $User.displayName $ListOfGroups > > $CurrentRow++ > $CurrentCol = 1 > } > > And my $ListOfGroups writes out on my screen, but does NOT get written > into the spreadsheet. > > What's that about? > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to [email protected] > with the body: unsubscribe ntsysadmin > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to [email protected] with the body: unsubscribe ntsysadmin
