Search or browse our knowledge base to find answers to your questions ranging from account questions to troubleshooting error messages. The content is curated and updated by our global Support team
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.
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.
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
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)
As best practice, first take a backup of the database: How to BackUp and Restore Qlik NPrinting Repository Database from End to End
Enter your old password and new password (x2) as requested
UAU alias WOW!