locked
Exception from HRESULT: 0x800A138A At line...... RRS feed

  • Question

  • I have PS files that are all ok running on Windows 7 with Powershell 4.
    I got error "Exception from HRESULT: 0x800A138A At line......" when running on Windows 10
    After logging on the website, cannot get any elements on the page:

    $ie = New-Object -Com "InternetExplorer.Application"
    $ie.Navigate("https://www.company.com")
    While ($ie.busy) { Start-Sleep -S 1 }
    $ie.visible = $true
    $ie.Document.getElementById('logonID').value = 'MyLogonID'
    $ie.Document.getElementById('password').value = 'myPassword'
    $ie.Document.getElementById('logonButton').click()
    While ($ie.busy) { Start-Sleep -S 1 }

    $t = $ie.document.getElementsByTagName('table')
    Exception from HRESULT: 0x800A01B6
    At line:1 char:1
    + $t = $ie.document.getElementsByTagName('table')
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OperationStopped: (:) [], NotSupportedException
        + FullyQualifiedErrorId : System.NotSupportedException



    • Edited by Ian3 Monday, February 1, 2016 12:21 AM
    Monday, February 1, 2016 12:16 AM

Answers

  • As the error states your call is NOT SUPPORTED!  IE on windows 10 enforces more isolation and security.  THe error is likely caused by bad javascript on the page.  See:https://www.google.com/?gws_rd=ssl#newwindow=1&q=0x800A138A

    Exception from HRESULT: 0x800A01B6
    At line:1 char:1
    + $t = $ie.document.getElementsByTagName('table')
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OperationStopped: (:) [], NotSupportedException
        + FullyQualifiedErrorId : System.NotSupportedException


    \_(ツ)_/

    • Proposed as answer by Elaine Jing Monday, February 1, 2016 8:44 AM
    • Marked as answer by Elaine Jing Wednesday, February 24, 2016 9:00 AM
    Monday, February 1, 2016 12:37 AM
  • On the same webpages, my scripts all work well on IE11/PS4/Windows7 but not on IE11/PS5/Windows10.

    Your scripts are calling IE. IE on the two systems is a different IE.  IE on W10 is more completely sandboxed nd is more secured.  It also completely enforces HTML5 rules whereas IE on W7 is less restrictive and less secure.  The error is being thrown by IE and not by PS.

    I suspect that you page is causing a call to JavaScript that is then forcing the error.  Why is hard to determine without seeing the page code.  Is in an HTTS page?  that can further aggravate the issue.

    I can run that code on W10 with no issue but I cannot run it against your page.  Since the exception is related to bad JavaScript calls I have to assume it is the page you are calling.  Inspect the page in the IE debugger and you  will see that it is HTML5 and it is being forced to execute a JS call when you access the page or that it is causing a violation of page security. 

    Again. The code works for me in W10 with no errors on a similar page.  YOU may also have an IE security add-in that is causing this.  disable all add ins and try again to check that.

    In all cases I cannot see how this is a PowerShell issue.


    \_(ツ)_/

    • Proposed as answer by Elaine Jing Wednesday, February 24, 2016 9:00 AM
    • Marked as answer by Elaine Jing Wednesday, February 24, 2016 9:00 AM
    Sunday, February 7, 2016 8:14 AM

All replies

  • As the error states your call is NOT SUPPORTED!  IE on windows 10 enforces more isolation and security.  THe error is likely caused by bad javascript on the page.  See:https://www.google.com/?gws_rd=ssl#newwindow=1&q=0x800A138A

    Exception from HRESULT: 0x800A01B6
    At line:1 char:1
    + $t = $ie.document.getElementsByTagName('table')
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OperationStopped: (:) [], NotSupportedException
        + FullyQualifiedErrorId : System.NotSupportedException


    \_(ツ)_/

    • Proposed as answer by Elaine Jing Monday, February 1, 2016 8:44 AM
    • Marked as answer by Elaine Jing Wednesday, February 24, 2016 9:00 AM
    Monday, February 1, 2016 12:37 AM
  • How can you say this is a java error when it works in Win 7 and not Win 10. I am having the same issue. My powershell script works in IE 11 in both Win 7,8 2008 but not in Win 10 and 2012. There must be some sort of new security blocking access to the elementByID. It would be nice to resolve the issue.
    Tuesday, February 2, 2016 2:54 PM
  • Is there a way to downgrade Powershell in Windows 10 to version 4 ? Thanks.
    Sunday, February 7, 2016 3:34 AM
  • Is there a way to downgrade Powershell in Windows 10 to version 4 ? Thanks.

    No.  This has nothing to do with PowerShell.  It is IE related as the error states.

    \_(ツ)_/

    Sunday, February 7, 2016 4:05 AM
  • On the same webpages, my scripts all work well on IE11/PS4/Windows7 but not on IE11/PS5/Windows10.
    Sunday, February 7, 2016 4:43 AM
  • On the same webpages, my scripts all work well on IE11/PS4/Windows7 but not on IE11/PS5/Windows10.

    Your scripts are calling IE. IE on the two systems is a different IE.  IE on W10 is more completely sandboxed nd is more secured.  It also completely enforces HTML5 rules whereas IE on W7 is less restrictive and less secure.  The error is being thrown by IE and not by PS.

    I suspect that you page is causing a call to JavaScript that is then forcing the error.  Why is hard to determine without seeing the page code.  Is in an HTTS page?  that can further aggravate the issue.

    I can run that code on W10 with no issue but I cannot run it against your page.  Since the exception is related to bad JavaScript calls I have to assume it is the page you are calling.  Inspect the page in the IE debugger and you  will see that it is HTML5 and it is being forced to execute a JS call when you access the page or that it is causing a violation of page security. 

    Again. The code works for me in W10 with no errors on a similar page.  YOU may also have an IE security add-in that is causing this.  disable all add ins and try again to check that.

    In all cases I cannot see how this is a PowerShell issue.


    \_(ツ)_/

    • Proposed as answer by Elaine Jing Wednesday, February 24, 2016 9:00 AM
    • Marked as answer by Elaine Jing Wednesday, February 24, 2016 9:00 AM
    Sunday, February 7, 2016 8:14 AM
  • Try with $ie.Document.IHTMLDocument3_getElementById instead

    Start-Process -FilePath $(Join-Path ${Env:ProgramFiles(x86)} "Internet Explorer\iexplore.exe") -ArgumentList "-private $Url"
    $ie = (New-Object -COM "Shell.Application").Windows() | ? { $_.Name -eq "Internet Explorer" } #or filter by Url
    $ie.visible = $true
    $ie.silent = $false
    $ie.Document.IHTMLDocument3_getElementById("logonID").click()
    $ie.Document.IHTMLDocument3_getElementById("logonID").value ='MyLogonID'

    • Proposed as answer by KAlbrecht Friday, August 26, 2016 8:35 PM
    Tuesday, July 19, 2016 1:02 PM
  • Thank you! I wrote a script a few months ago which was working fine until updates.

    Thanks for actually adding a solution unlike the others who just say "This is an IE problem", you are a hero!


    RyanHaylo88

    Except that it doesn't work for the exact problem described although it is a way to access some pages.  It will not work for Google or Microsoft sites.


    \_(ツ)_/

    Tuesday, September 6, 2016 5:35 PM
  • There is no such way to call using CLASSNAME

    getElemetsByClassName('....')

    Thursday, August 2, 2018 7:21 AM
  • KAlbrecht's approach worked for me.

    FWIW, my code (trimmed down to the essentials):

    $ie = new-object -ComObject "InternetExplorer.Application"
    $ie.silent = $true
    $ie.visible = $false  // for headless browser
    
    $ie.navigate2('http://myurl')  // navigate() should also work
    
    $ie.Document.IHTMLDocument3_getElementsByName('my_Element_Name')


    Thursday, August 16, 2018 4:08 PM
  • TomaszT's method worked for me, as well.  My issue was that Invoke-WebRequest was not working with loading the page due to the way JS is loading it (ie:  kendo grid wasn't populating for me to parse), so I had to fall back to this IE engine method directly.

    It was working sporadically and I was getting this error randomly until I used IHTMLDocument3_getElementsByName  .  Now, I am loading all data consistently.  Thanks


    • Edited by mrjminer Tuesday, February 11, 2020 7:39 AM
    Tuesday, February 11, 2020 7:22 AM