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
Solved

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

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Set OWA language and time zone in Exchange for individuals, all users or per database.
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 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