I am writing a script with a GUI for work and I have an Issue that I am having trouble getting past. I am trying to get the Department to show all of our departments in a combobox but when the script pulls the departments from the AD it also displays the @{Name= before every department name (see image below).
Here is the block I am having issues with
$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)
