AnsweredAssumed Answered

Powershell script never ends

Question asked by AshutoshSingh609672 on May 9, 2018
Latest reply on Jun 6, 2018 by Luu Le

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