format data into a table.

This question is not answered


I am having a hard time formatting this command into a more easly read table. i would like to have a column of users with the user data under and a column name primary group with the primary group data under this. can someone help me with this?

Your help is greatly apprecaited.

get-content c:\username.txt | get-qaduser  | %{"User:{0} Primary Group:{1}" -f $_.Name,(get-qadgroup "$($_.domain.sid)-$($_.primarygroupid)").Name }


All Replies
  • I found this syntax somewhere, but it works:

    get-qaduser someuser |select Name,@{n="Primary Group";e={(Get-QADGroup "$($_.Sid.AccountDomainSid)-$($_.PrimaryGroupId)").name}}

    So I think for what you are trying I would do:
    get-content c:\username.txt | get-qaduser |select Name,@{n="Primary Group";e={(Get-QADGroup "$($_.Sid.AccountDomainSid)-$($_.PrimaryGroupId)").name}}

  • Works Like a charm... Thx Dude!!!