Here is a nice example of a one liner.
(Get-ADUser –filter “Name –like ‘Adm*’” –Properties MemberOf).MemberOf
This will return the FQDN of the groups the user is a member of. The first portion need to execute first and that is why we placed it inside of parenthesis. We then had to specifically tell PowerShell to give us the MemberOf property. Once the first portion of the command completes, we have an object to work with. Now we just simply ask PowerShell to provide us with the MemberOf property.
Comments