Today I had to promote a local event to everyone on our cloud taskforce. The distribution list we have for everyone interested in cloud projects is quite large so I thought I would share this one-liner with you.
The first version I tried was quite straight-forward – simply get all team members and filter out the members based on their city:
Get-QADGroupMember Cloud -Indirect | where { $_.City-eq "Aliso Viejo" }
However, this actually was quite slow – because the group is big and all the filtering was happening on the client side (all objects were extracted from domain controller and then filtered by PowerShell on my workstation). The solution is to use parameters of the initial Get cmdlet. Get-QADGroupMember unfortunately does not have the City parameter yet, so I used the universal LdapFilter parameter to do the proper filtering.
Get-QADGroupMember Cloud -Indirect -LdapFilter '(l=Aliso Viejo)'
This second one-liner performed almost twice faster – so this is the one I would recommend for large group use!
Dmitry