Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
jrathgebercs
Creator
Creator

Start the Qlik Sense QMC job from another server using PowerShell script.

Hi Team,

We have one Dummy Qlik Sense QMC job that is dependent on another server job where we are receiving the data. The QlikSense QMC job will be executed after the data has been refreshed from another server.

We have PowerShell script which is running fine in old server but when we trying to execute this PowerShell in newly migration server. Getting forbidden error.

Please find my script below.

cls
 
$hdrs = @{}
$hdrs.Add("X-Qlik-xrfkey","iX83QmNlvu87yyAB")
$url = "https://Myserver/qrs/about?xrfkey=iX83QmNlvu87yyAB"
#$response = Invoke-RestMethod  -Uri $url -Method Get -Headers $hdrs -SessionVariable websession
$response = Invoke-RestMethod -UseDefaultCredentials -Uri $url -Method Get -Headers $hdrs -SessionVariable websession
$cookies = $websession.Cookies.GetCookies($url)
 
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.Cookies.Add($cookies)
$response = @{}
 
$hdrs = @{}
$hdrs.Add("X-Qlik-xrfkey","iX83QmNlvu87yyAB")
$url = "https://Myserver/qrs/task//start/synchronous?name=DummyJobForTrigger&xrfkey=iX83QmNlvu87yyAB"
$response = Invoke-RestMethod -WebSession $session -Uri $url -Method Post -Headers $hdrs -ContentType 'application/json'
$response.value -like "????????-????-????-????-????????????"

Error screenshot:

jrathgebercs_0-1748498174378.png

 

Could you please check and suggest ?

 

Regards,

Irshad Ahmad

Labels (4)
1 Solution

Accepted Solutions
Levi_Turner
Employee
Employee

403 is a post auth (i.e. the authentication was successful) denial based on access. The most obvious step to verify is that the user who is running the PowerShell script has sufficient rights to do perform the action. In this interactive session I can run the whoami command to see the user then verify that they have sufficient rights to execute the task (RootAdmin will assuredly grant them this right, you can customize the security rules to provide this without the RootAdmin role):

Levi_Turner_1-1748523930498.png

It's unclear what is executing this script, but I would start by running it as your target user. Then running it in whatever system / process / application will be executing the script.

 

View solution in original post

1 Reply
Levi_Turner
Employee
Employee

403 is a post auth (i.e. the authentication was successful) denial based on access. The most obvious step to verify is that the user who is running the PowerShell script has sufficient rights to do perform the action. In this interactive session I can run the whoami command to see the user then verify that they have sufficient rights to execute the task (RootAdmin will assuredly grant them this right, you can customize the security rules to provide this without the RootAdmin role):

Levi_Turner_1-1748523930498.png

It's unclear what is executing this script, but I would start by running it as your target user. Then running it in whatever system / process / application will be executing the script.