Get only common members between text file and ad group member.


hello,

i have txt file users samaccountname (1column) , need show(in datagrid) common members in specific ad group (freeappli group).

text file :  x0001  x0002  ...  freeappli:  x9090  x0001  x0002    datagrid:  x0001  x0002
thank you

try:

$usersfromfile = get-content ".\users1.txt"  $usersfromgroup = (get-adgroupmember -identity "freeappli").samaccountname  $commommembers = $usersfromfile.where({ $usersfromgroup -contains $_ })  # intersection of 2 arrays  $commommembers


sam boutros, senior consultant, software logic, kop, pa http://superwidgets.wordpress.com (please take moment vote helpful and/or mark answer, applicable) _________________________________________________________________________________ powershell: learn before it's emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Domain migration ERR3:7075 Failed to change domain affiliation, hr=8007054a This operation is only allowed for the Primary Domain Controller of the domain

How do a find data in one file, search for it in another file and if not found, write a custom message to another file