Alle Active Directory Gruppen in einem Listview ausgeben

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Post Reply
Werner1088
Posts: 2
Last visit: Tue Nov 15, 2022 9:33 am

Alle Active Directory Gruppen in einem Listview ausgeben

Post by Werner1088 »

Hallo PowerShell Freunde,

Ich suche eine Möglichkeit (Source), mit dem ich in meiner Form alle Active Directory Gruppen in einem Listview ausgeben kann. Im Listview sollen der Name, die GroupCategory und GroupScope ausgegeben werden. Kann mir dabei bitte helfen?

Hello PowerShell friends,

I am looking for a way (source) to output all Active Directory groups in a listview in my form. In the listview I want to output the name, GroupCategory and GroupScope. Can help me with this please?

$Groups = Get-ADGroup -Filter{GroupCategory -eq "security"}
ForEach ($Group in $Groups)
{

$itm = New-Object System.Windows.Forms.ListViewItem
$itm.ImageIndex = 0
$itm.Name = $Group.Name
$itm.Text = $Group.Name
$itm.Subitems.Add($Group.GroupCategory)
$itm.Subitems.Add($Group.GroupScope)
$listView3.Items.Add($itm)

}
bekomme keine Ausgabe in meinem Listview, was mache ich falsch?

do not get any output in my listview, what am I doing wrong?
Last edited by Werner1088 on Sun Nov 13, 2022 10:18 pm, edited 1 time in total.
jvierra
Posts: 15337
Last visit: Wed Nov 30, 2022 12:48 am
Answers: 27
Has voted: 4 times
Been upvoted: 30 times

Re: Alle Active Directory Gruppen in einem Listview ausgeben

Post by jvierra »

Hi Werner,

Here is a TreeView that will show you how to work with AD and WinForms controls.
Attachments
Demo-ADSITreeView.psf
(23.67 KiB) Downloaded 54 times
jvierra
Posts: 15337
Last visit: Wed Nov 30, 2022 12:48 am
Answers: 27
Has voted: 4 times
Been upvoted: 30 times

Re: Alle Active Directory Gruppen in einem Listview ausgeben

Post by jvierra »

Here is another demo that shows other methods of working with the Net Framework ADSI classes.
Attachments
Demo-ADUpdateForm.psf
(23.63 KiB) Downloaded 55 times
Werner1088
Posts: 2
Last visit: Tue Nov 15, 2022 9:33 am

Re: Alle Active Directory Gruppen in einem Listview ausgeben

Post by Werner1088 »

Hello, thank you for your answer, but unfortunately this is not what I am looking for.
jvierra
Posts: 15337
Last visit: Wed Nov 30, 2022 12:48 am
Answers: 27
Has voted: 4 times
Been upvoted: 30 times

Re: Alle Active Directory Gruppen in einem Listview ausgeben

Post by jvierra »

jvierra
Posts: 15337
Last visit: Wed Nov 30, 2022 12:48 am
Answers: 27
Has voted: 4 times
Been upvoted: 30 times

Re: Alle Active Directory Gruppen in einem Listview ausgeben

Post by jvierra »

Here is a working demo showing how to populate and use a ListView.
Attachments
Demo-ListView.psf
(37.83 KiB) Downloaded 55 times
Post Reply