none
Calling InternetExplorer.Application from PowerShell running as a scheduled task will not work. RRS feed

  • Question

  • Hi everyone, 

    Bring up an unresolved issue ( InternetExplorer.Application cannot work with task scheduler ) . 

    I found out i just having same issue here, the script will failed when it run with task scheduler.  (it work if i run with manually) 

    As the content is in iframe. webclient, invoke-webrequest are  not able to catch it. we need UI to run and fetch the content. 

    Task scheduler, Run with high privilege, or any setting has been tried. it not helping.   

    $ie = New-Object -ComObject "InternetExplorer.Application"
        $ie.navigate("$AlertUrlByID")
        $ie.visible = $true
        while($ie.Busy) {start-sleep -Milliseconds 1000}
        $doc = $ie.document.body.getElementsByClassName("formlink") | select href
        

    i would like to search a URL link in a particular website that in iframe (java), schedule to be run in every 15 mins .

    Thursday, July 20, 2017 8:12 AM

Answers


  • I have read 5 times before posting it. 

    Anyway, i think i just sort it out by create another scheduled task to keep user session "Always Active" in the server And for the Powershell InternetExplorer.Application,   Tick on the " Run Only When User Is Logged On "  .  JUST realized if this opt is choose, it will run in UI .   Previous suggestion i found from any source of web is all misleading   ... Invoke-WebRequest can run as task BUT it cant get the content in iframe and i still it need UI session to get it. 

    Go back and try to create a same scenario then you will know.


    Hi~ o(* ̄▽ ̄*)ブ4

    • Marked as answer by JimmyEu Tuesday, July 25, 2017 6:06 AM
    Thursday, July 20, 2017 10:23 AM

All replies

  • You cannot run IE as a task and make it visible.  IE requires a full session to run correctly.

    You will likely have issues with IE and Java as most will be either Ajax or obfuscated.

    To get the information you must script it in a logged in session and work out if you can actually get the information. 

    You might be able to use "Invoke-WebRequest" as a task.

    Also go back and carefully read why the issue in the link you posted cannot be resolved.


    \_(ツ)_/


    • Edited by jrv Thursday, July 20, 2017 9:15 AM
    Thursday, July 20, 2017 9:12 AM

  • I have read 5 times before posting it. 

    Anyway, i think i just sort it out by create another scheduled task to keep user session "Always Active" in the server And for the Powershell InternetExplorer.Application,   Tick on the " Run Only When User Is Logged On "  .  JUST realized if this opt is choose, it will run in UI .   Previous suggestion i found from any source of web is all misleading   ... Invoke-WebRequest can run as task BUT it cant get the content in iframe and i still it need UI session to get it. 

    Go back and try to create a same scenario then you will know.


    Hi~ o(* ̄▽ ̄*)ブ4

    • Marked as answer by JimmyEu Tuesday, July 25, 2017 6:06 AM
    Thursday, July 20, 2017 10:23 AM