I'm following along with a powershell tutorial here.
I am unable to get the comboxBox to populate as they have in this example. Keeps passing a null item to the combobox helper method of PS Studio.
Im able to get a list of my orgs OUs, by name at a console with:
Get-ADOrganizationalUnit -SearchBase 'OU=accounts,DC=corp,DC=company,DC=org' -SearchScope OneLevel -filter * | ft name
I cant wrap my head around translating this console query over to a combobox in studio.
That format-table
is returning a single multi-line string with embedded format codes and newlines, not objects. If you want an array of the OU names for your combobox, trade that for select-object
and use -ExpandProperty
on the Name property:
Get-ADOrganizationalUnit -SearchBase 'OU=accounts,DC=corp,DC=company,DC=org' -SearchScope OneLevel -filter * |
select -ExpandProperty Name