I have set up a GUI to allow service desk staff to manage accounts. As part of this I want to have a dropdown box listing all the security goups so they don't have to type the group name and path.
The combobox is populating with the group names, but it is in the format @{name=<group name>}
The powershell code I am using for this is:
{
$groups = Get-ADGroup -Filter 'GroupCategory -eq "Security"' -Properties name | select name
$editusersecgroupentrybox.DataSource = $groups
$editusersecgroupentrybox.DisplayMember = "name"
$editusersecgroupentrybox.ValueMember = "name"
}
It gives an error saying it cannot bind to the new display member but it populates the combobox. If I comment out or remove line 6 the error is not seen and the combobox is still populated with the same results
What do I need to change to just display the group name rather than the @{name=.....}
UPDATE:
I tested the add/remove script using the combobox as it is now, it fails because it looks like it is reading the group names as they are displayed. I changed the combobox type to 0 so I could type into the box and edit the text displayed. Even after removing the @{name= and the closing } it errors saying it cannot find an object with identity '@name=......} so it is not reading the actual text, it is reading the value it pulled.