After bring up the windows system Print window on a webpage by using Powershell script andmanually press Enter key, it will print to xps as default printer. However, it will not print after use SendKeys:
$wshell = New-Object -com WScript.Shell
$wshell.sendkeys("{ENTER}")
Or use
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{Enter}")
But they all work after using $ie.ExecWB(6, 2) to bring window up.
Any idea why? Thanks