Trigger QlikView Publisher EDX Task From Windows Powershell

Here’s a script to trigger an EDX task from Powershell. As it is, you will need to change QVSERVER to match your server name. The script can then be run from the command line by passing the task name and EDX password as parameters.

Download the QlikView EDX Trigger in Powershell. Do not copy and paste the code below.

param($taskName,$taskEDXPassword)

function QVPOST([string]$updateurl, [string]$text)
{
     $result = $null
     [System.Net.HttpWebRequest] $request = [System.Net.HttpWebRequest] [System.Net.WebRequest]::Create($updateurl)
     $request.UseDefaultCredentials = $true
     $request.Method = "POST"
     $request.ContentType = "application/x-www-form-urlencoded"
     $request.ContentLength = $text.Length

     [System.IO.StreamWriter] $stOut = new-object System.IO.StreamWriter($request.GetRequestStream(), [System.Text.Encoding]::ASCII)
     $stOut.Write($text)
     $stOut.Close()

     [System.Net.HttpWebResponse] $response = [System.Net.HttpWebResponse] $request.GetResponse()
     if ($response.StatusCode -ne 200)
     {
           $result = "Error : " + $response.StatusCode + " : " + $response.StatusDescription
     }
     else
     {
           $sr = New-Object System.IO.StreamReader($response.GetResponseStream())
           $result = $sr.ReadToEnd()
     }

     return $result
}

1$response = 1(QVPOST "http://QVSERVER:4720/qtxs.asmx" "<Global method=`"GetTimeLimitedRequestKey`" />")
$requestKey = $response.GetTimeLimitedRequestKey.GetTimeLimitedRequestKeyResult

$taskEDXRequest=@"
<Global method="RequestEDX" key="$($requestKey)">
<i_TaskIDOrTaskName>$($taskName)</i_TaskIDOrTaskName>
<i_Password>$($taskEDXPassword)</i_Password>
<i_VariableName />
<i_VariableValueList />
</Global>
"@

$response = QVPOST "http://QVSERVER:4720/qtxs.asmx" $taskEDXRequest
echo $response.RequestEDX.RequestEDXResult

Related posts:

  1. How To Request A Ticket Using QlikView’s HTTP Server
  2. Using QlikView Tickets
  3. Writeback in QlikView
  4. Missing Feature In Set Analysis
  5. QlikView in the Cloud

4 thoughts on “Trigger QlikView Publisher EDX Task From Windows Powershell

  1. Pingback: Diigo bookmarks 04/01/2011 (a.m.) @countnazgul.com

  2. Hello,

    I was trying your script but it doesn’t work, the number 1 on line 30 gives error.

    I’ve tried to remove but the $requestKey never gets a value.

    Thank you very much,

    Pedro

  3. Thank you. I have had a lot of trouble with the code format plugin. Please use the new download link. I added a ZIP file with the correct code.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>