PowerShell-InternetExplorer:0x80010108(RPC_E_DISCONNECTED) [英] PowerShell - InternetExplorer: 0x80010108 (RPC_E_DISCONNECTED)

查看:96
本文介绍了PowerShell-InternetExplorer:0x80010108(RPC_E_DISCONNECTED)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用PowerShell自动执行InternetExplorer,以在我们的Intranet中打开一个站点(受信任的站点|受保护的模式:关闭)

I want to automate the InternetExplorer with PowerShell to open a site in our intranet (trusted sites | protected mode: off)

当我执行我的代码时,IE会打开Intranet网站,但是对$ ie对象的引用会丢失.

When I´m executing my code the IE open the intranet site but the reference to the $ie object is lost.

错误: 调用的对象已与其客户端断开连接. (来自HRESULT的异常:0x80010108(RPC_E_DISCONNECTED))

Error: The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))

我该如何解决? (不允许以admin身份运行IE)

How can I fix this? (Run IE as admin is not a option)

$ie = New-Object -ComObject InternetExplorer.Application
$ie.visible = $true
$ie.Navigate($url)
$ie

我的解决方法,但不是很好:

My workaround, but not so good:

& "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)

推荐答案

尝试以管理员身份运行PowerShell.

Try running PowerShell as an administrator.

这篇关于PowerShell-InternetExplorer:0x80010108(RPC_E_DISCONNECTED)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆