Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have been writing to get the following powershell script to work but I'm getting the error listed below it not sure what would be causing the issue. The user account that the script is running under has admin access to the instance as an administrator and is running on the server where the Qlik Sense instance is located.
add-type -path "D:\QLIK\Software\TypeLib\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll"
add-type -path "D:\QLIK\Software\TypeLib\QlikSense.NetSDK\lib\net452\Qlik.Engine.dll"
add-type -path "D:\QLIK\Software\TypeLib\QlikSense.NetSDK\lib\net452\Qlik.Sense.JsonRpc.dll"
add-type -path "D:\QLIK\Software\TypeLib\QlikSense.NetSDK\lib\net452\Qlik.Sense.Client.dll"
$QlikSenseServer = "QlikSenseServer" #Name of the Qlik Sense Server
$SenseServerURL = "https://QlikSenseUrl/"
$ProxyUsesSSL = $true
$TrustAllCerts = $true
$QlikCeredentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$Location = [Qlik.Engine.Location]::FromUri($SenseServerURL)
$Credentials = [Qlik.Engine.LocationExtensions]::AsNtlmUserViaProxy($Location,$ProxyUsesSSL,$QlikCeredentials,$TrustAllCerts)
$AppIdentifiers = [Qlik.Engine.LocationExtensions]::GetAppIdentifiers($Location)
Error:
Exception calling "GetAppIdentifiers" with "1" argument(s): "The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseReceived'"
At D:\QLIK\Development\PowerShell\LoadScriptAudit0.ps1:25 char:1
+ $AppIdentifiers = [Qlik.Engine.LocationExtensions]::GetAppIdentifiers($Location)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebSocketException
I have been looking at the script in more detail for some reason the variable $QlikCeredentials is not getting the details of the userid the script is running under.
Got the get-credentials part to work properly now but still the same error occuring
I have been working with something similar but I do get an error message
"Exception calling "AppWithId" with "2" argument(s): "Ticket retrieval failed.""
When trying the line
$AppIdentifiersByID = [Qlik.Engine.LocationExtensions]::AppWithId($Location,$AppID)
Otherwise my setup is pretty much the same. The weird thing is that it works when I run the script on my local laptop with a VPN connection, but when I am signed on the qlik server and trying the script I get the Ticket retrieval failed error. I'll continue to debug on my end, hopefully we can find a solution.
I have been following the following community post to try and view the load script.
Solved: Re: edit script load editor with .net SDK - Page 2 - Qlik Community - 1755324
I had a good look at the server and found that the dll's that the post told me to download are already on the server.
I tried to do an add type with the already registered dlls and got a different error this time.
add-type : Could not load file or assembly 'file:///C:\Program Files\Common Files\Qlik\Custom Data\QsAppMetadataConnector\Newtonsoft.Json.dll' or one of its dependencies. Operation is not
supported. (Exception from HRESULT: 0x80131515)
At D:\QLIK\Development\PowerShell\LoadScriptAudit.ps1:9 char:1
+ add-type -path "C:\Program Files\Common Files\Qlik\Custom Data\QsAppMetadataConn ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand
add-type : Could not load file or assembly 'file:///C:\Program Files\Common Files\Qlik\Custom Data\QsAppMetadataConnector\Qlik.Engine.dll' or one of its dependencies. Operation is not
supported. (Exception from HRESULT: 0x80131515)
At D:\QLIK\Development\PowerShell\LoadScriptAudit.ps1:10 char:1
+ add-type -path "C:\Program Files\Common Files\Qlik\Custom Data\QsAppMetadataConn ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand
add-type : Could not load file or assembly 'file:///C:\Program Files\Common Files\Qlik\Custom Data\QsAppMetadataConnector\Qlik.Sense.JsonRpc.dll' or one of its dependencies. Operation is
not supported. (Exception from HRESULT: 0x80131515)
At D:\QLIK\Development\PowerShell\LoadScriptAudit.ps1:11 char:1
+ add-type -path "C:\Program Files\Common Files\Qlik\Custom Data\QsAppMetadataConn ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand
add-type : Could not load file or assembly 'file:///C:\Program Files\Common Files\Qlik\Custom Data\QsAppMetadataConnector\Qlik.Sense.Client.dll' or one of its dependencies. Operation is not
supported. (Exception from HRESULT: 0x80131515)
At D:\QLIK\Development\PowerShell\LoadScriptAudit.ps1:12 char:1
+ add-type -path "C:\Program Files\Common Files\Qlik\Custom Data\QsAppMetadataConn ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand
This is the post that I was following:
@michasiuk I cant talk directly to the files you found in QsAppMetadataConnector as they are from a 3rd party and there may be version differences... but using the binaries in the latest version of QsAppMetadataConnector, it seems throw a error.
if you get a copy of the Qlik Scalability tools you can get the binaries from the SDKExerciser folder.
Additionally [System.Net.CredentialCache]::DefaultNetworkCredentials does not return anything in my lab... so you may need to reconsider that... something like this
$binaryroot = "C:\ExtractLocation\ScalabilityTools\scalabilitytools-5.12.3\SDKExerciser\Feb2021"
add-type -path "$($binaryroot)\Newtonsoft.Json.dll"
add-type -path "$($binaryroot)\Qlik.Engine.dll"
add-type -path "$($binaryroot)\Qlik.Sense.JsonRpc.dll"
add-type -path "$($binaryroot)\Qlik.Sense.Client.dll"
$QlikSenseServer = "QlikSenseServer" #Name of the Qlik Sense Server
$SenseServerURL = "https://QlikSenseUrl/"
$ProxyUsesSSL = $true
$TrustAllCerts = $true
if ($null -eq $QlikCeredentials){
$credfile = "$($env:USERPROFILE)\pwsh_cred_$($env:USERNAME).clixml"
if (Test-Path $credfile){
$QlikCeredentials = Import-Clixml $credfile
}else{
$QlikCeredentials = Get-Credential
$QlikCeredentials|Export-Clixml $credfile
}
}
$Location = [Qlik.Engine.Location]::FromUri($SenseServerURL)
$Credentials = [Qlik.Engine.LocationExtensions]::AsNtlmUserViaProxy($Location,$ProxyUsesSSL,$QlikCeredentials,$false)
$AppIdentifiers = [Qlik.Engine.LocationExtensions]::GetAppIdentifiers($Location)
or as you appear to be running it on the server you could just use the QlikClient for authentication...