hi,

What about inverting select and where and using expand

$groupinfo
= Get-ADGroupMember -Identity $group | Where-Object {($_.samaccountname
-notin $users) -and ($_.samaccountname -notin $excludeusers)} | select
-expand samaccountname

On Fri, Oct 30, 2015 at 5:40 PM, <[email protected]> wrote:

> $apvgroups = $null
>
> $apvgroups = @{}
>
> foreach
> ($group in $groups)
>
> {
>
> $groupinfo
> = Get-ADGroupMember -Identity $group | select samaccountname |
> Where-Object {($_.samaccountname -notin $users) -and ($_.samaccountname
> -notin $excludeusers)}
>
> $apvgroups
> .add($group,$groupinfo)
>
> }
>
>
>
> Here is the output i'm getting:
>
>
>
> PS C:\Windows\system32> $apvgroups
>
> Name Value
>
> ---- -----
>
> FA-EQIS APV Sewer {@{samaccountname=ED_TH}, @{samaccountname=BILL_J},
> @{samaccountname=SCOTT_SY}, @{samaccountname=DAN_CO}}
>
> FA-APV - Personnel Database
>
> AA-APV manifest.apvcentral.com {@{samaccountname=NICOLE_C},
> @{samaccountname=SCOTTMCK}, @{samaccountname=JAMES_ME},
> @{samaccountname=IRIS_D}}
>
> AA-APV Database - Mileage S... @{samaccountname=NICOLE_C}
>
> FA-EQIS APV Linden Operations {@{samaccountname=DAN_CO},
> @{samaccountname=BRYANNAG}, @{samaccountname=MARY_KU}}
>
> FA-EQIS APV Northern PA Ope... {@{samaccountname=MARC_F},
> @{samaccountname=SCOTTMCK}, @{samaccountname=DAN_CO},
> @{samaccountname=JAMES_L}...}
>
> FA-EQIS APV Brooklyn Operat... {@{samaccountname=BISI_A},
> @{samaccountname=KRIS_B}, @{samaccountname=NICOLE_C},
> @{samaccountname=SHAWN_H}...}
>
>
>
> I just want the samaccountname values inserted into the hashtable.
>
> ================================================
> Did you know you can also post and find answers on PowerShell in the
> forums?
> http://www.myitforum.com/forums/default.asp?catApp=1


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to