title: Select IE window using HWND
body: <p>Wondering if it is possible to select an IE window based on the HWND property (or similar). My script clicks a link which opens a new page in a separate window and I would like to be able to work with this new window. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>$ie.Navigate("https://chaseloanmanager.chase.com/Chaselock/ViewOnlineGuide.aspx") # opens page in new window
  while ($ie.Busy -eq $true){Start-Sleep -Seconds 2}
  
  $childWindow = Get-Process | Where-Object {($_.ProcessName -eq 'iexplore')} | Get-ChildWindow | Where-Object {$_.ChildTitle -match 'Lending'} 
  $childWindow.MainWindowHandle # gets HWND of new window
  
  $shell = New-Object -ComObject Shell.Application
  $ie3 = $shell.Windows() | Where-Object {$_.HWND -match $childWindow.MainWindowHandle} # does not find window
  </code></pre>