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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
michasiuk
Creator
Creator

QlikNprinting-CLI PowerShell module Connect-NPrinting gives unauthorised response

@Marc

I'm using the QlikNprinting-CLI PowerShell module but when I run the Connect-Nprinting Command:

Connect-NPrinting -AuthScheme ntlm -Computer NprintingServerName -TrustAllCerts

I get this error:

WARNING: From: https://NprintingServerName:4993/api/v1/login/ntlm
Response: Unauthorized

I then tried using the following code to connect which I have gotten to work on another server.

 

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #Set the security protocol

add-type @"

using System.Net;

using System.Security.Cryptography.X509Certificates;

public class TrustAllCertsPolicy : ICertificatePolicy {

public bool CheckValidationResult(

ServicePoint srvPoint, X509Certificate certificate,

WebRequest request, int certificateProblem) {

return true;

}

}

"@

[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy #Set the trust Policy

#Set up the connections to Nprinting Api interface and logon to Nprinting

$url = "https://$($NprintingFQDN):4993/api/v1/login/ntlm"
$s = Invoke-RestMethod -UseDefaultCredentials -Uri $url -Method Get -SessionVariable websession

But this time I get the following error:

Invoke-RestMethod : {"result":null,"code":1,"message":null}
At line:2 char:6
+ $s = Invoke-RestMethod -UseDefaultCredentials -Uri $url -Method Get - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Not fully sure what I should be looking for to fix these errors or what would be causing them. 

Labels (1)
11 Replies
michasiuk
Creator
Creator
Author

May not be support by Qlik but it's mentioned on one of the official Qlik Websites as an available tool kit see https://qlik.dev/toolkits/qlik-cli/.

Marc
Employee
Employee

QlikNprinting-CLI is not the same thing as qlik-cli.

Qlik-CLI is a Executable, 

QlikNprinting-CLI is a PowerShell Module