Solved

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

Posted on 2011-09-15
1
597 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
This article will help you understand what HashTables are and how to use them in PowerShell.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

12 Experts available now in Live!

Get 1:1 Help Now