Automic Workload Automation

 View Only
  • 1.  Powershell script never ends

    Posted May 09, 2018 07:24 AM

    Hi All,

     

    I am working on a requirement for Website scraping and so have built a powershell script to perform this task.

    The Powershell script runs completely fine when executed through Command Prompt on the Windows Server however when I port the same script to Automic Engine in the form of a WIN Job, the JOB never ends and the report is also not generated as it stays on the Windows Agent and is not passed to the Automic Engine..

     

    Can somebody please help here..

    We are using Automic Engine V12..

     

    The script is as follows :

     

    $ErrorActionPreference = "SilentlyContinue"
    $URL = 'http://mysite/report/'
    $HTML = Invoke-WebRequest -Uri $URL
    $body = ($HTML.ParsedHtml.getElementsByTagName(‘div’) | Where{ $_.className -eq ‘entry-content’ } ).innerHTML|Out-String
    $CIM=($HTML.ParsedHtml.getElementsByTagName(‘div’) | Where{ $_.className -eq ‘CIM’ } ).innerHTML|Out-String
    $Oncall=($HTML.ParsedHtml.getElementsByTagName(‘div’) | Where{ $_.className -eq ‘On-call’ } ).innerHTML|Out-String

    write-host "CIM is "$CIM
    write-host "On-call is"$Oncall



  • 2.  Re: Powershell script never ends

    Posted May 09, 2018 11:01 AM

    I have been unable to re-create your problem.  Suggest you add some echo commands to the beginning and between each powershell line and try again to expose where the point of failure might be.  



  • 3.  Re: Powershell script never ends

    Posted Jun 06, 2018 01:44 PM

    Hi AshutoshSingh609672 

     

    Were you able to narrow down where the point of failure was with the suggestion suggested from Pete?