Windows 7 来自HRESULT的Powershell COM对象异常:0x80010108(RPC_E_已断开连接)

Windows 7 来自HRESULT的Powershell COM对象异常:0x80010108(RPC_E_已断开连接),windows-7,com,powershell,Windows 7,Com,Powershell,我正在尝试使用powershell在internet explorer中编写一些任务的脚本。这包括在登录网站后从网站下载文件。我有一个正在工作的测试脚本,但实际站点的相同代码给了我以下错误: “=”运算符失败:调用的对象已与其客户端断开连接。(来自HRESULT的异常:0x80010108(RPC_E_已断开连接))。 在U:\PowershellScriptProjectSFTP\test.ps1:71 char:22 +$controlRef=我自己刚刚遇到这个问题,发现以“管理员”身份运行

我正在尝试使用powershell在internet explorer中编写一些任务的脚本。这包括在登录网站后从网站下载文件。我有一个正在工作的测试脚本,但实际站点的相同代码给了我以下错误:

“=”运算符失败:调用的对象已与其客户端断开连接。(来自HRESULT的异常:0x80010108(RPC_E_已断开连接))。 在U:\PowershellScriptProjectSFTP\test.ps1:71 char:22
+$controlRef=我自己刚刚遇到这个问题,发现以“管理员”身份运行Powershell窗口解决了这个问题。

尽管如此,您能否发布错误消息中引用的实际代码行?该错误发生在$browserDoc=$ie.Document行(此处第9行)。随后提到的错误发生在尝试基于$browserDoc.getelementbyid分配$email、$pass和$login时,这不可思议地解决了我的问题!你找到办法了吗?我无法以管理员身份运行ps。。。?
$browserDoc
$ie = new-object -com "InternetExplorer.Application"
$ie.navigate("about:blank")
$ie.visible = $true
[System.Threading.Thread]::Sleep(2000)
$ie.navigate($URL)
#get controls
write-host "Getting Document"
$browserDoc=$ie.Document    
write-host "Getting Email component"
$email = $browserDoc.getElementById("MainContent_userEmail")
write-host "Getting Password component"
$pass = $browserDoc.getElementById("MainContent_userPassword")
write-host "Getting Button component"
$login = $browserDoc.getElementById("MainContent_submitButton")