LaP*_*Phi 13 powershell internet-explorer
我想用PowerShell自动化InternetExplorer以在我们的Intranet中打开一个站点(可信站点|保护模式:关闭)
当我执行我的代码时,IE打开内部网站点但是对$ ie对象的引用丢失了.
错误: 调用的对象已与其客户端断开连接.(来自HRESULT的异常:0x80010108(RPC_E_DISCONNECTED))
我怎样才能解决这个问题?(运行IE作为管理员不是一个选项)
$ie = New-Object -ComObject InternetExplorer.Application
$ie.visible = $true
$ie.Navigate($url)
$ie
Run Code Online (Sandbox Code Playgroud)
我的解决方法,但不太好:
& "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)
Run Code Online (Sandbox Code Playgroud)
    |   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           5284 次  |  
        
|   最近记录:  |