我想与自动化PowerShell中的InternetExplorer在我们的内联网,打开一个网站(受信任的站点|保护模式:关闭)
当I'm执行我的代码IE打开内网网站,但参考$即目标丢失。
错误:调用已经与其客户端断开连接的对象。 (从HRESULT异常:0x80010108(RPC_E_DISCONNECTED))
我怎样才能解决这个问题? (运行IE作为管理员不是一个选项)
$ie = New-Object -ComObject InternetExplorer.Application
$ie.visible = $true
$ie.Navigate($url)
$ie
我的解决办法,但不是那么好:
& "C:\Program Files\Internet Explorer\iexplore.exe" $urls
Start-Sleep 5
$shell = New-Object -com Shell.Application
$ie = @($shell.Application.Windows())| Where-Object { $_.LocationUrl -like "*$urls*" }
$ie.Navigate($url2)