I have a Powershell script with a Windows Forms UI from which I create a new Powershell instance, which in turn starts IE (hidden) and grabs information from a website.
Sometimes the UI locks up and only becomes responsive again after manually killing the hidden IE-process via task manager. Seemingly IE freezes and this locks up the UI.
Mainly I am trying to understand why this happens. Although it happens every day, so far I was not able to reproduce it by i.e. intentionally creating a new thread which does not respond. Also I thought a new instance can never lock the main thread anyway, or am I wrong and it is to be expected?
$script:Posh1 = [PowerShell]::Create()
$script:Posh1.AddScript($IEcode)
$script:Posh1.AddParameter("url1",$url1)
$script:Posh1.AddParameter("url2",$url2)
$script:Posh1.BeginInvoke()