Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Highlighted
narasimhamurthy
New Contributor

Unable to run Qlik- cli qliksense CMDlet for powershell

Hi,

We are using QLIk-Cli.psm1 to start the task remotely.

I am able to run the powershell script through application service ID, but if same script when I try to run with our another alternate service ID( used only for remote execution) it doesn't work.

I tried providing Admin access to Alternate Service ID, it doesn't work.

 

Below is the error::\CorpData\UserFiles\QlikSenseBatch\Job\JHDH_Composable_Extract_test.ps1

********************************************************************************************************************

Invoke-RestMethod : The remote server returned an error: (403) Forbidden.

At E:\CorpData\UserFiles\QlikSenseBatch\QlikCliTaskTrigger\Qlik-Cli.psm1:77 char:15

+ ... $result = Invoke-RestMethod -Method $method -Uri $path @params -Ses ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

Invoke-RestMethod : The remote server returned an error: (403) Forbidden.

At E:\CorpData\UserFiles\QlikSenseBatch\QlikCliTaskTrigger\Qlik-Cli.psm1:80 char:15

+ ... $result = Invoke-RestMethod -Method $method -Uri $path @params -Web ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

Get-Member : You must specify an object for the Get-Member cmdlet.

At E:\CorpData\UserFiles\QlikSenseBatch\QlikCliTaskTrigger\Qlik-Cli.psm1:116 char:30

+ ... $Script:enums = $enums | Get-Member -MemberType NoteProperty | forea ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : CloseError: (:) [Get-Member], InvalidOperationException

+ FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand

 

Invoke-RestMethod : The remote server returned an error: (403) Forbidden.

At E:\CorpData\UserFiles\QlikSenseBatch\QlikCliTaskTrigger\Qlik-Cli.psm1:80 char:15

+ ... $result = Invoke-RestMethod -Method $method -Uri $path @params -Web ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

Invoke-RestMethod : The remote server returned an error: (403) Forbidden.

At E:\CorpData\UserFiles\QlikSenseBatch\QlikCliTaskTrigger\Qlik-Cli.psm1:80 char:15

+ ... $result = Invoke-RestMethod -Method $method -Uri $path @params -Web ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

Invoke-RestMethod : The remote server returned an error: (403) Forbidden.

At E:\CorpData\UserFiles\QlikSenseBatch\QlikCliTaskTrigger\Qlik-Cli.psm1:80 char:15

+ ... $result = Invoke-RestMethod -Method $method -Uri $path @params -Web ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

Get-Member : You must specify an object for the Get-Member cmdlet.

At E:\CorpData\UserFiles\QlikSenseBatch\QlikCliTaskTrigger\Qlik-Cli.psm1:116 char:30

+ ... $Script:enums = $enums | Get-Member -MemberType NoteProperty | forea ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : CloseError: (:) [Get-Member], InvalidOperationException

+ FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand

 

Invoke-RestMethod : The remote server returned an error: (403) Forbidden.

At E:\CorpData\UserFiles\QlikSenseBatch\QlikCliTaskTrigger\Qlik-Cli.psm1:80 char:15

+ ... $result = Invoke-RestMethod -Method $method -Uri $path @params -Web ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

************************************************************************************************************

I tried following adding execution policy, it did not work.

Set-ExecutionPolicy RemoteSigned

 

It will be great help if someone can advice on how to fix this.

 

Script:

 

import-module "E:\CorpData\UserFiles\QlikSenseBatch\QlikCliTaskTrigger\Qlik-Cli.psm1"

connect-qlik Servername -username Internal\sa_scheduler

start-qliktask "Task Name"

 

Regards,

bharath