I’m currently writing a script that uses get-service | select Displayname to show whats running.
However, I’m having trouble.
I’m using this:
function Getcurrent-AD
{
$Script:current_active_d = get-service | select Displayname
$array = New-Object System.Collections.ArrayList
$array.AddRange($current_active_d)
$current_output.DataSource = $array
$objForm.refresh()
}
and
$moveright.Add_Click({
$selectedRow = $current_output.CurrentRowIndex
if (($procid=$Script:current_active_d["$selectedRow"].displayname)) {
write-host $procid
}
}
)
to create an array and put it in a data form grid which then writes to host where I’m clicking but I can only get it to work so that it display in the console the first item selected.
Please Help!
Try this: