Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Manipulating object values in a collection

$
0
0

I have the following collection,.....

     $group = a,b,c,d

I am trying to access a group under an OU...... the users are under the following structure   

        OU

            sub level

                a

                b

                c

I have a GUI which I present difference level under OU in a combox box object and I build the query to access the users under that group...

$GroupUsers=Get-ADGroupMember$DropDownGUsers.SelectedItem.ToString()|select-object@{Name=$DropDownGUsers.SelectedItem.ToString();Expression={$_.Name}}  

this part works... I retrieve a list of users as

      $GroupUsers

              sub level

              a

              b

              c

In order to iterate thru the collection, I try to build the following query

I use the following code.....

   foreach ($group in $GroupsUsers)

   {

        $group | select -expand {$_.  "'" + $DropDownUsers.SelectedItem.ToString() + "'"}

   }

    The combox selection contains the group and the group contains embedded spaces.

      so after it gets interpret it should create the following statement

                  a,b,c | select -expand {$_.'sub level'} which will allow me to access every value and that value

I will plug it TO get-ADUser -Filter 'Name -like _____' -Properties

I can NOT build the statement dynamic... Any suggestions    

 


michael john ocasio




Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>