Solved

Adding all users from AD group to list view

Posted on 2016-10-10
2
20 Views
Last Modified: 2016-10-10
This is my first time looking into using list view in powershell studio.  I am looking to get all users in an active directory group and show them in a list view. After I get the working eventually I would like to be able to select a user in the list view and remove that user from the AD group with a button.

So for now I am just looking for help on how to query AD for a list of users and show them in the list.
Here is the line of code I can use to show the list in the powershell ise. How can I populate a listview object with this list of users?
Get-ADGroupMember -identity "students" -Recursive | Get-ADUser -Property DisplayName | Select Name
0
Comment
Question by:Roccat
  • 2
2 Comments
 

Accepted Solution

by:
Roccat earned 0 total points
Comment Utility
This look like it does the trick.

$here = Get-ADGroupMember -identity "yard-students" -recursive | Get-ADUser -Property DisplayName | Select -expandproperty Name
	
	foreach ($Whole_name in $here)
	{
		Add-ListViewItem -ListView $listview1 -Items $Whole_name
	}

Open in new window

0
 

Author Comment

by:Roccat
Comment Utility
I ended up changing the listview to listbox

$here = Get-ADGroupMember -identity "yard-students" -recursive | Get-ADUser -Property DisplayName | Select -expandproperty Name
load-listbox -Listbox $listbox1 -Items $here
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Synchronize a new Active Directory domain with an existing Office 365 tenant
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 tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

10 Experts available now in Live!

Get 1:1 Help Now