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: 
ahaleiii-craneware
Partner - Contributor II
Partner - Contributor II

Can Repository.exe be run Headlessly?

Hello, I am trying to automate a migration of our existing Qlik Sense Enterprise for Windows instance to a new VM. As part of this migration, and due to compliance requirements, we are forbidden from RDPing into the VM, so the install & restore must be performed in an automated fashion via Ansible/PowerShell.

One of the steps which must be run as part of migrating is running the Repository.exe with the arguments "-bootstrap -standalone -restorehostname" to align the migrated data with the new server. (Using this doc and this video as references.)

I am able to run this command in a PowerShell terminal manually, but the moment I put it into a script and try to capture the output, it fails with this error:

[ERROR] Fatal exception during bootstrap: The handle is invalid.
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
   at Qlik.Sense.Common.ConsoleUtility.ClearConsoleLine(Int32 offset)
   at Repository.Core.Bootstrap.BootstrapHandler.Initialize()
   at Repository.QRSMain.AssembleConfiguration(IEnumerable`1 args)
   at Repository.QRSMain.Run(String[] args, Action`1 terminate)
Bootstrap mode has terminated. Press ENTER to exit..

Is there a way to run Repository.exe in a way that I can capture the output and parse it in my script to take automated actions from the results?

 

Labels (1)
1 Solution

Accepted Solutions
ahaleiii-craneware
Partner - Contributor II
Partner - Contributor II
Author

Closing the loop on this, I was able to find a solution that worked by creating a Scheduled Task in Windows.

Abbreviated PowerShell:

$action = New-ScheduledTaskAction -Execute 'C:\Program Files\Qlik\Sense\Repository\Repository.exe' -Argument '-bootstrap -standalone -restorehostname'
$principal = New-ScheduledTaskPrincipal -UserId (whoami) -LogonType Password -RunLevel Highest
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -MultipleInstances IgnoreNew
$taskDefinition = New-ScheduledTask -Action $action -Principal $principal -Settings $settings
$taskName = 'QlikSense_Bootstrap_RestoreHostname'
$task = Register-ScheduledTask -TaskName $taskName -InputObject $taskDefinition -User (whoami) -Password $env:QLIK_ADMIN_PASSWORD -Force
$task | Start-ScheduledTask
# custom logic to poll the task status; the process often stalls trying to find the license server
Stop-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue

 

This allowed me to move forward, and I have been able to fully automate an entire Qlik migration without RDP'ing into the VM.

Some more details:

  • Qlik Sense Enterprise on Windows May 2023
  • Windows Server 2022 Datacenter Azure Edition
  • PowerShell version: 5.1.20348.4294

View solution in original post

1 Reply
ahaleiii-craneware
Partner - Contributor II
Partner - Contributor II
Author

Closing the loop on this, I was able to find a solution that worked by creating a Scheduled Task in Windows.

Abbreviated PowerShell:

$action = New-ScheduledTaskAction -Execute 'C:\Program Files\Qlik\Sense\Repository\Repository.exe' -Argument '-bootstrap -standalone -restorehostname'
$principal = New-ScheduledTaskPrincipal -UserId (whoami) -LogonType Password -RunLevel Highest
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -MultipleInstances IgnoreNew
$taskDefinition = New-ScheduledTask -Action $action -Principal $principal -Settings $settings
$taskName = 'QlikSense_Bootstrap_RestoreHostname'
$task = Register-ScheduledTask -TaskName $taskName -InputObject $taskDefinition -User (whoami) -Password $env:QLIK_ADMIN_PASSWORD -Force
$task | Start-ScheduledTask
# custom logic to poll the task status; the process often stalls trying to find the license server
Stop-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue

 

This allowed me to move forward, and I have been able to fully automate an entire Qlik migration without RDP'ing into the VM.

Some more details:

  • Qlik Sense Enterprise on Windows May 2023
  • Windows Server 2022 Datacenter Azure Edition
  • PowerShell version: 5.1.20348.4294