Get-ADComputer and MemberOf
active-directory, powershell, powershell-2.0
Solution
Your trouble comes from the fact that the primary group is not part of the `memberOf` attribute.
So try this :
Get-ADUser -Filter * -Properties * | Select-Object -Property Name,MemberOf,PrimaryGroup | Sort-Object -Property Name
You'll find a deeper explanation in this answer.
Problem
I am very new to Powershell and am having an issue when using the `Get-ADUser` and `GetADComputer` cmdlets. I am trying to use the `Get-ADComputer` and `Get-ADUser` to retrieve the `memberOf` from Active-Directory of all the users and computers. It only appears to be retrieving information from users and computers that are in 2 or more groups. Any users/computers that are only in 1 group display nothing. For example: If UserA is in group Administrators I get no output when I use MemberOf. But if User2 is in both Administrators and Domains Administrators I get some output. However it will only output one of those groups. Get-ADGroup does the same thing. Is this normal? I can't imagine it is. Here is my code: ``` Get-ADUser -Filter * -Properties * | Select-Object -Property Name,MemberOf | Sort-Object -Property Name ``` Thanks