?
Solved

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

Posted on 2011-09-15
1
Medium Priority
?
643 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

770 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