Qlik Community

Qlik Sense Enterprise Documents

Documents for Qlik Sense related information.

Automate application list export and import in QlikSense with PowerShell

hadooqlik
New Contributor III

Automate application list export and import in QlikSense with PowerShell

Hello everyone,

this is a util powershell cmdlet which allows you to automate some of task that Qlik does't support like application list export and import. Also, it helps you to create rules from a text file.

This is my contribution to original cmdlet developed by ahaydon GitHub - ahaydon/Qlik-Cli: Qlik Sense Cmdlet for PowerShell

The link to my contribution GitHub - Mochis/Qlik-Cli: Qlik Sense Cmdlet for PowerShell

I hope this help you!

Thanks

JuanJo

Comments
erikadvectas
Valued Contributor

Hi!

I just tried your script out with the Get-QlikApp or the Export-QlikAppList feature, however I can't get it to work. Any ideas?

Logged in as the service account, running PowerShell as an administrator:

gci cert:currentuser\my | where { $_.friendlyname -eq 'QlikClient' } | Connect-Qlik SERVERNAME

Get-QlikApp -id d83199a5-4a81-496e-be45-6e16d4778e43

The cert part works, but for the other parts I get:

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

At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Qlik-Cli\Qlik-Cli.psm1:75 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

Running Export-QlikAppList does nothing

Any ideas?

Best regards,

Erik Gustafsson

hadooqlik
New Contributor III

Hi Erik,

First, try to import the client certificate (generated by qlik sense server) in your client machine that will connect to qlik sense server.

After that, if above doesn't work, then you must change the next lines in .psm code:

[string]$computername,
# UserId to use with certificate authentication in the format domain\username
[string]$username = "$($env:userdomain)\$($env:username)",

Put "SERVERNAME" in $computername variable like:

[string]$computername = "SERVERNAME"


and

Put "SERVERNAME\USERNAME" such as:

[string]$username = "SERVERNAME\USERNAME",

For better log information use the -verbose param in commands.

It should perform the authentication succesfully when you invoke a rest method like Get-QlikApp.

I hope it helps you!

Regards,

Juanjo

brindlogcool
Contributor III

What value has to be passed for the certificate parameter. If I provide certificate name it throws the error as

cannot process argument transformation on parameter 'certificate'. Cannot convert value "*.abc.com" to type "System.Security.Cryptography.X509Certificates.X509Certificate". Error: "The system cannot find the file specified.

We need to give the SSL certificate name or Root or client certificate. i tried to check the Get-help it doesn't have much info.

hadooqlik
New Contributor III

Hi,

You have to install client certificate in windows certificate store.

Steps:

1- Generate client certificate from Qlik Sense Server

2- Install client certificate on client machine

3- Run this command to try that certificate works fine

     gci cert:currentuser\my | where { $_.friendlyname -eq 'QlikClient' } | Connect-Qlik [YOUR_SERVERNAME]


Regards,

Juanjo

brindlogcool
Contributor III

Thanks it worked..

brindlogcool
Contributor III

gci cert:currentuser\my | where { $_.friendlyname -eq 'QlikClient' } | Connect-Qlik [YOUR_SERVERNAME] it works .But the Export-QlikApp -id 13fc20ea-0eb21-1213cb-9a2e-4d59554562d93a4fd is not working and geting the below error.


Invoke-RestMethod : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

At C:\windows\system32\windowspowershell\v1.0\Modules\Qlik-cli\Qlik-cli.psm1:75 char:15

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

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

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

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

Invoke-RestMethod : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

At C:\windows\system32\windowspowershell\v1.0\Modules\Qlik-cli\Qlik-cli.psm1:75 char:15

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

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

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

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

brindlogcool
Contributor III

Also where the file will be downloaded?

Version history
Revision #:
1 of 1
Last update:
‎05-20-2016 05:33 AM
Updated by: