Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW

How to recover or update the NPrinting repository database super user password

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Sonja_Bauernfeind
Digital Support
Digital Support

How to recover or update the NPrinting repository database super user password

Last Update:

Mar 25, 2024 7:13:04 AM

Updated By:

Sonja_Bauernfeind

Created date:

Oct 13, 2017 7:42:57 PM

Attachments

Company policy may sometimes include the need to change the NPrinting PostgreSQL repository database password.

Depending on the version of NPrinting deployed, different methods are used. 

Content:

 

Qlik NPrinting 19 to 20 and later

For Qlik NPrting releases beginning with February 2019, follow the steps outlined below. Note that these steps are written for PowerShell. The scripts are attached in individual .zip files. 

How to recover the current NPrinting repository password

Use the attached Powershell script named  RecoverNPRepoPassword.ps1 or Open Windows Powershell ISE as an administrator on your NPrinting server and run the script manually.

Note that an error may be printed when attempting to run the ps1 file: 

The file ......RecoverNPRepoPassword.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170.

In this case, run the following first to temporarily set the execution policy to bypass for only the current PowerShell session after the window is closed. 

The command is: 

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Click Yes on the popup window and proceed with running the provided script.

The Powershell ISE to run individually are: 

$ConfigFile = "C:\Program Files\NPrintingServer\NPrinting\WebEngine\webengine.config"

Function Decrypt-WithMachineKey([Parameter(Mandatory = $True, ValueFromPipeline)]$input)
{
Add-Type -AssemblyName System.Security
$secured = [System.Convert]::FromBase64String($input)
$bytes = [Security.Cryptography.ProtectedData]::Unprotect($secured, $null, [Security.Cryptography.DataProtectionScope]::LocalMachine)
return [System.Text.Encoding]::UTF8.GetString($bytes)
}

[xml]$Xml = Get-Content $ConfigFile
$PGHost = $Xml.SelectSingleNode('//add[@key = "pg-host"]')
$PGPort = $Xml.SelectSingleNode('//add[@key = "pg-port"]')
$PGDB = $Xml.SelectSingleNode('//add[@key = "pg-database"]')

You should see the current password on your PowerShell window:

$PGUserName = $Xml.SelectSingleNode('//add[@key = "pg-username"]')
$PGPassword = $Xml.SelectSingleNode('//add[@key = "pg-password"]')

Write-host "Existing Repository Configuration:" -ForegroundColor Green
Write-host "$($PGUserName.value)@$($PGHost.value):$($PGPort.value)/$($PGDB.value)"
write-host "Password for $($PGUserName.value): " -NoNewline -ForegroundColor Gray
write-host "$($PGPassword.value|Decrypt-WithMachineKey)" -ForegroundColor Red

 

Update the current NPrinting repository password

If you do not know the old password, use UpdateNPRepoPassword.ps1 or open Windows Powershell ISE as an administrator on your NPrinting server and run:

$NewPassword = "NewPasswordValueHere"
$ConfigFile = "C:\Program Files\NPrintingServer\NPrinting\WebEngine\webengine.config"
Function Encrypt-WithMachineKey([Parameter(Mandatory = $True, ValueFromPipeline)]$input)
{
Add-Type -AssemblyName System.Security

$bytes = [System.Text.Encoding]::UTF8.GetBytes($input)
$secured = [Security.Cryptography.ProtectedData]::Protect($bytes, $null, [Security.Cryptography.DataProtectionScope]::CurrentUser)
return [System.Convert]::ToBase64String($secured)
}
[xml]$Xml = Get-Content $ConfigFile
$PGPassword = $Xml.SelectSingleNode('//add[@key = "pg-password"]')
$NewEnvPassword = $NewPassword|Encrypt-WithMachineKey
$PGPassword.value = $NewEnvPassword
$XML.Save($ConfigFile)

If you know the old password, use UpdateOldNPRepoPassword.ps1 or open Windows Powershell ISE as an administrator on your NPrinting server and run:

$NewPassword = "NewPasswordValueHere"
$ConfigFile = "C:\Program Files\NPrintingServer\NPrinting\WebEngine\webengine.config"
Function Encrypt-WithMachineKey([Parameter(Mandatory = $True, ValueFromPipeline)]$input)
{
Add-Type -AssemblyName System.Security

$bytes = [System.Text.Encoding]::UTF8.GetBytes($input)
$secured = [Security.Cryptography.ProtectedData]::Protect($bytes, $null, [Security.Cryptography.DataProtectionScope]::CurrentUser)
return [System.Convert]::ToBase64String($secured)
}
Function Decrypt-WithMachineKey([Parameter(Mandatory = $True, ValueFromPipeline)]$input)
{
Add-Type -AssemblyName System.Security
$secured = [System.Convert]::FromBase64String($input)
$bytes = [Security.Cryptography.ProtectedData]::Unprotect($secured, $null, [Security.Cryptography.DataProtectionScope]::LocalMachine)
return [System.Text.Encoding]::UTF8.GetString($bytes)
}
[xml]$Xml = Get-Content $ConfigFile
$PGUserName = $Xml.SelectSingleNode('//add[@key = "pg-username"]')
$PGPassword = $Xml.SelectSingleNode('//add[@key = "pg-password"]')
write-host "Previous Password for $($PGUserName.value): " -NoNewline -ForegroundColor Gray
write-host "$($PGPassword.value|Decrypt-WithMachineKey)" -ForegroundColor Red
$NewEnvPassword = $NewPassword|Encrypt-WithMachineKey
$PGPassword.value = $NewEnvPassword
$XML.Save($ConfigFile)

 

Qlik NPrinting 17 and 18

As best practice, first take a backup of the database: How to BackUp and Restore Qlik NPrinting Repository Database from End to End

Part 1 - Database

  1. Open Windows Services.msc and stop all NPrinting services except QlikNprintnigRepoService
  2. Browse to folder C:\Program Files\NPrintingServer\pgsql\bin and launch  pgAdmin3.exe.
  3. For Nprinting 18 go to C:\Program Files\NPrintingServer\pgsql\pgAdmin 4\bin and launch pgamdmin4.exe
  4. Click Add a connection to a server
  5. Use the following details in New Server Registration
    Name: Nprinting
    Server: localhost
    Port: 4992
    Maintenance DB: postgres (select from pull down)
    Username: postgres
    Password:  The password that you entered during installation
  6. Once connected, select Nprinting then go to File > Change Password...
  7. Enter your old password and new password (x2) as requested

Part 2 - Qlik NPrinting

  1. Open Windows Services.msc and stop the QlikNprintnigRepoService as well
  2. Update the "pg-password" key value stored in these 2 config files to the new password:
    C:\Program Files\NPrintingServer\NPrinting\WebEngine\webengine.config
    C:\Program Files\NPrintingServer\NPrinting\Scheduler\scheduler.config
  3. Start all NPrinting services
Labels (1)
Comments
fmarvnnt
Partner - Creator III
Partner - Creator III

UAU  alias WOW!

korsikov
Partner - Specialist III
Partner - Specialist III

I think you miss some info. 
When we update NP repo password we are need to update 3 files

C:\Program Files\NPrintingServer\NPrinting\WebEngine\webengine.config

C:\Program Files\NPrintingServer\NPrinting\Scheduler\scheduler.config

c:\Program Files\NPrintingServer\NPrinting\Audit\audit.config

but all scripts contain only webengine.config file update. 

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @korsikov 

We're reviewing this, thank you!

All the best,
Sonja 

Version history
Last update:
Monday
Updated by: