Help for a gui script

Hi,

I need help,

I want to make a script to display all the groups of a windows user in a gui using the cmd let “Get-ADGroupMember” then I can select several of them to do a click button event that copy the selected groups into another users that needs the groups.

what should I use to do that ? combobox ? listview ?..

Then I suggest a multiselect listbox.

You can use Out-GridView as a gui to display and select multiple users.

Get-ADGroupMember -Identity group1 |Out-GridView -Passthru -OutputMode Multiple

There are ways to do what you are after without write any GUI/Form code. See these.

Creating a Simplistic GUI Interface with Out-GridView
https://mikefrobbins.com/2014/09/11/creating-a-simplistic-gui-interface-with-out-gridview

Creating a GUI Using Out-GridView in PowerShell

Fun with PowerShell’s Out-GridView

Poor Man’s GUI

Show-Command - PowerShell for GUI admins?
https://4sysops.com/archives/show-command-powershell-for-gui-admins

Tag Archives: Out-Gridview (A PowerShell Core Out-Gridview Solution)

https://jdhitsolutions.com/blog/tag/out-gridview
https://jdhitsolutions.com/blog/tag/out-gridview/page/2

So, stuff like…

(Get-ADGroupMember -Identity $((Get-ADGroup -Filter '*').Name | 
Sort-Object | 
Out-GridView -Title 'Select a group' -PassThru)).Name | 
Out-GridView -Title 'Select member name(s)' -OutputMode Multiple

The write whatever code you want to process that return.