Wednesday, 3 October 2018

QlikSense Batch files

Setting up a Qliksense data load batch file:

To set up batch files is quite straight forward to schedule the reloading of QlikSense app data:


1. Download and install this tool: https://github.com/eapowertools/QlikSenseTask


2. Set up the tasks in QMC without a scheduler and test will manually run

(note: If there is an issue with the scheduler ref QlikSense Scheduler Task keeps resetting and cannot run tasks)


3. Create batch file similar to the following code:

"C:\PowerTools\QlikSenseTask.exe" -task:"EXACT TASK NAME" -proxy:https://FULLQLIKSEVER.com -wait:600

[txt file and rename to .bat]



SSIS


In order for SSIS to execute batch files on another server remotely, you need to use PSEXEC. It can be downloaded here, as well as having all the commands
https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

1. First download and the psexec.exe put into a folder on the server or local machine to SSIS. E.g. c:\PowerTools\PSEXEC.exe or \\ServerSharedetails\PowerTools\PSEXEC.exe

2. Test in command line on ssis/local to server:
C:\PowerTools\PsExec.exe \\SERVER "C:\FoldertoBat on server\Admin.bat"

3. If this does not work and get access denied. You need to run the following regdit on the QlikServer and then RESTART the Qlik Server:
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

(
You can check this is set up by going to the following path in the registry
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system\LocalAccountTokenFilterPolicy and setting it to 1
)

4. SSIS set up:

In SSIS create an execute process task and add an executable expression with the psxec tested command:
C:\PowerTools\PsExec.exe \\SERVER "C:\FoldertoBat on server\Admin.bat"

[Note: this will run under the SSIS account the job runs under so you should test with this account to make sure it has permissions to run psexec on the server with the batch files].




3 - Reg setting manual set up step if do not want to run the command line:
(
 Remote UAC will block them from being able to do things like remote execution.
A quick way to test if this might be your issue:
  1. Access the server via filesharing (\\YOURSERVER\C$); you should be able to login with your credentials.
  2. Access the server via filesharing, but this time go to the admin share (\\YOURSERVERNAME\ADMIN$); this should fail. This is what we need to fix.
To get around this, you can make a registry change:
  1. Open RegEdit on your remote server
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
  3. Add a new DWORD value called LocalAccountTokenFilterPolicy
  4. Set its value to 1
  5. Reboot your remove server
  6. Try running PSExec again from your local server
)


**Troubleshooting:
-Still getting access denied...

Try the following on the server running the batch files:

1) sc delete PSEXESVC (if there's already a psexec service running)
2) Reboot server
3) Copy new PsExec.exe to c:\Windows\System32 (if not already there, or copy newer psexec version there)
4) SC create PSEXESVC binpath= c:\Windows\System32\PsExec.exe



1 comment:

  1. Thank you so much for helping out and making people focus on different utilities of Qlik View especially through this blog post.

    Qlik Soap API Connection

    ReplyDelete