简体   繁体   English

无法获取OU结构来填充comboBox

[英]Unable to get OU structure to populate a comboBox

I'm following along with a powershell tutorial here . 我在这里跟随着powershell教程。

I am unable to get the comboxBox to populate as they have in this example. 我无法像本例中那样填充comboxBox。 Keeps passing a null item to the combobox helper method of PS Studio. 始终将空项目传递到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. 我无法将这个控制台查询翻译成Studio中的组合框。

That format-table is returning a single multi-line string with embedded format codes and newlines, not objects. format-table返回的是一个包含嵌入式格式代码和换行符的多行字符串,而不是对象。 If you want an array of the OU names for your combobox, trade that for select-object and use -ExpandProperty on the Name property: 如果想要组合框的OU名称数组,则将其-ExpandProperty select-object并在Name属性上使用-ExpandProperty

Get-ADOrganizationalUnit -SearchBase 'OU=accounts,DC=corp,DC=company,DC=org' -SearchScope OneLevel -filter * |
select -ExpandProperty Name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM