I'm trying to automate the certificate renewal process and want to update proxy with the latest thumbprint using a powershell script. I have installed qlik-cli and the script is running fine when I manually run it using an admin account. However, I want a scheduled task to run the script and I'm using SYSTEM user to do it. Below are the commands that I'm running, 'Connect-Qlik' is not working because it is unable to find the 'QlikClient' certificate in the certificate store of the SYSTEM user. Please let me know how can this certificate 'QlikClient' be created for the SYSTEM user.
$thumbprint = (Get-ChildItem -Path cert:\LocalMachine\My -Recurse | Where-Object {$_.Subject -match "$PrimarySan"} | Sort-Object -Property NotBefore -Descending | Select-Object -first 1).Thumbprint
Write-host "Thumbprint is $thumbprint" >> P:\postScriptOutFile.log
Get-ChildItem cert:CurrentUser\My | Where-Object { $_.FriendlyName -eq 'QlikClient' } | Connect-Qlik $PrimarySan -Verbose -UserName <Domain/service_user> -TrustAllCerts >> P:\postScriptOutFile.log
Update-QlikProxy -id (Get-QlikProxy -full).id -SslBrowserCertificateThumbprint $thumbprint >> P:\postScriptOutFile.log
As workaround, I have exported the qlikclient certificate from CurrentUser\My and imported to LocalMachine\My so that the system account can access it. This works fine.