So take this code:
function populate([string] $group)
{
$listbox.items.clear()
Get-ADGroup -filter {cn -like "*$group*"} |
foreach {$listbox.items.add($_.DistinguishedName)}
}
$go.Add_Click(
{
populate -group $text.text
})
I'm trying to take the variable $group and pass it to {cn -like "*$group*"} but I can't get it to work. Does anybody have any ideas?
Thanks