Solved

How to search for ad property and put result in a listbox via powershell?

Posted on 2011-09-15
1
606 Views
Last Modified: 2012-08-14
I'm using the following command:
Get-QADUser -IncludedProperties extensionAttribute1 -SearchRoot someou | ft extensionAttribute1

This returns the value of this property for every user in that ou. I want the value to be added to a listbox but only once for each value and use this in the script found here(http://technet.microsoft.com/en-us/library/ff730949.aspx)
 e.g. the above script returns 5 times "something1" and 5 times "something2". I want the listbox containing just 1 time "something1" and 1 time "something2" so I can use this in the selectbox([void] $objListBox.Items.Add("something1").

How can I achieve this?

Thnx Remco
0
Comment
Question by:pr0fier
1 Comment
 

Accepted Solution

by:
pr0fier earned 0 total points
ID: 36544912
solved it by using the following commands:

      $arrTitle = Get-QADUser -IncludedProperties extensionAttribute1 -SearchRoot [root] | foreach {$_.extensionAttribute1} | select -uniq
      
      foreach ($arr in $arrTitle){
      Write-Host $arr
      [void] $objListbox.Items.Add("$arr")            
      }
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
A brief introduction to what I consider to be the best editor for PowerShell.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now