Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
This code has worked on other machines in the past. It's just that we undergone a server replacement and the PowerShell is not working on the new serve The Qlik-CLI works but the QlikNprinting-CLI is causing me issues this time for some reason.
Before I forget the script is running under the same service account that the Qlik Nprinting Services are running under.
For windows integrated authentication (ntlm) to work, the Domain Account needs to be configured against a User in NPrinting. If it is not, then NPrinting does not know which of its users the request is coming from.
As you can see in the screen shot below.
On the Left the domain account is unpopulated and I get the same error you have.
On the right it is populated correctly and it works.
I already know about this and I have done this the development and preprod instances of Nprinting that I have and everything works fine there. The problem is that the production instance of Nprinting is giving me errors still even though I have defined the service account as a super user on the instance in the same way as the other two instances. Trying to figure what is different between the instances.
Trying to figure out what I should be looking for.
The Domain Account specified does not conform to Domain\Username
from the look of it, you may be missing the backslash between the domain and Username.
but you will notice, that under your domain account, it says "Not NT Domain User...."
it should show "Valid NT Domain User"
Apologies typo situation where I couldn't see my nose despite my face been looking at it for too long.
Note for all readers: QlikNprinting-CLI PowerShell module is not an official QlikTech product. We do not supply official support on it.
Regards,
Ruggero