Hello everybody,
i want to create a PowerShell GUI to manage AD User and their Groups. In the attachement you find the .psf.
My question is: How i can edit the Listview that it show me the clicked groups in the right Listview-Group "Add" or "Removed"?
Furthermore i need a way to list all groups which are added or removed in a array. How i can do this?
Management Groups in Listview
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.
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.
Management Groups in Listview
Last edited by bhnuser on Wed Apr 18, 2018 1:59 am, edited 1 time in total.
Re: Management Groups in Listview
Here is how to correctly load a ListBox from an array of strings:
Use the "SelectedIndexChanged" event of the ListBox to populate the list of groups.
Your full question is very hard to understand. Perhaps just create a simple form showing what you want.
The form post is using "ListBox" and not "ListView"
To display a users groups on a click event just have the click get the user group membership.
Code: Select all
$users = Get-AdUser -SearchBase 'OU=_Global,OU=Country,DC=lenze,DC=com' -Filter *
[void]$listUsername.Items.AddRange($users.Name)
Your full question is very hard to understand. Perhaps just create a simple form showing what you want.
The form post is using "ListBox" and not "ListView"
To display a users groups on a click event just have the click get the user group membership.
Re: Management Groups in Listview
I'm so sorry for the bad description!
I will attach a picture of my scenario. Yeah, I know it's a little bit unmanageable.
So, what i want is that there are no duplicate groups appear in the listview, and that I can filter the entries in two arrays, once in an adding-array and once in a deleting-array. In the next step this script should add or remove all listed AD-Groups to or from the person. As I have solved it at the moment, I do not know how to implement it.
I will attach a picture of my scenario. Yeah, I know it's a little bit unmanageable.
So, what i want is that there are no duplicate groups appear in the listview, and that I can filter the entries in two arrays, once in an adding-array and once in a deleting-array. In the next step this script should add or remove all listed AD-Groups to or from the person. As I have solved it at the moment, I do not know how to implement it.
- Attachments
-
- Admin-Tool.png (27.61 KiB) Viewed 1751 times
-
- MainForm.psf
- (120.11 KiB) Downloaded 123 times
Re: Management Groups in Listview
We can answer specific questions which I have as best I can given the request. It is beyond the scope of this and most forums to help you design a solution.
I recommend starting over and simplifying the form. Once you have become familiar with how t implement code in a form using control events and values you will likely begin to understand the limitations and capabilities of a form.
Forms and controls are designed to implement common patterns of usage and data updates. While you can imagine any sort of control layout the implementation may run counter to the intended usage of the controls. This happens often with those new to both PowerShell and Forms. Try starting with a simpler approach or project.
If you search you may still be able to find books discussing how to implement Windows Forms solution.
here are a number of articles that may be of help.
https://www.google.com/search?newwindow ... EOUDu82QYQ
I recommend starting over and simplifying the form. Once you have become familiar with how t implement code in a form using control events and values you will likely begin to understand the limitations and capabilities of a form.
Forms and controls are designed to implement common patterns of usage and data updates. While you can imagine any sort of control layout the implementation may run counter to the intended usage of the controls. This happens often with those new to both PowerShell and Forms. Try starting with a simpler approach or project.
If you search you may still be able to find books discussing how to implement Windows Forms solution.
here are a number of articles that may be of help.
https://www.google.com/search?newwindow ... EOUDu82QYQ