This is the tricky part of our script. Fortunately, PowerShell Studio gives us a helper function that makes it easier to populate our drop-down list. To use that, we’ll need to retrieve a list of event log names as plain strings, which we’ll store in the variable $logs:
$logs = Get-EventLog -ComputerName $ComputerName.Text ` -List | Select-Object -ExpandProperty Log
Note that the –ExpandProperty parameter of Select-Object is crucial here. Normally, Get-EventLog returns a collection of objects, and the event log name is in the Log property of those objects. We need to extract that information so that it’s a plain String, because plain Strings are what we need to put into the drop-down list box.
We then call the Load-ComboBox ...