0
我正在编写一个脚本,其中包含一个用于工作的GUI,并且我遇到了一个难以通过的问题。我试图让部门在组合框中显示我们所有的部门,但是当脚本从AD中拉出部门时,它还会在每个部门名称前面显示@{Name=
(请参阅下图)。PowerShell Get-ADGroup显示问题
这里是
$DepGroups = Get-ADGroup -Filter * -SearchBase "OU=Our Departments,DC=ourDC,DC=com" |
select Name | Sort -Property Name
$DepBox = New-Object System.Windows.Forms.ComboBox
$DepBox.Width = 136
$DepBox.Height = 20
$DepBox.Location = New-Object System.Drawing.Point(95,53)
$DepBox.Font = "Microsoft Sans Serif,10"
$DepBox.DropDownStyle = 'DropDownList'
$DepBox.Items.AddRange($DepGroups)
$Form.Controls.Add($DepBox)
的可能的复制[如何\'选择\'到字符串数组](https://stackoverflow.com/questions/45691978/how-to-select-to-an -array-of-strings) –