I\'m working on a GUI in PowerShell where I was throwing errors when certain comboboxes were clicked.
After the error was thrown, I could drop the combobox list down
If you have pscx installed, you can use Invoke-Apartment -Apartment STA -Expression { .... }
.
If not, have a look at WPF & PowerShell – Part 1 ( Hello World & Welcome to the Week of WPF ) where James creates runspace with STA. Another source might be Asynchronicity in PowerShell.
Or some older posts about custom cmdlet Single Threaded Apartment in PowerShell V1.