server-side command in a procedure does not run the script
Hello,
I experiment a strange behaviour using the server-side command within a procedure
I have two .bat files within the /Board/Job folder
- ListFiles.bat
- MergeFiles.bat
both are called at the same place in the procedure : (without any parameters passed through BOARD).
- The first one runs successfully (generates a text file)
- The second one doesn't run. If I run it manually from windows explorer (double-click on the file), it runs successfully and merges several PDF files into one single PDF file called Merged_reports.pdf.
Has anyone already went through this ?
The content of the second .bat file is:
del ..\..\Export\Merged_reports.pdf<br/>pdftk ..\..\Export\*.pdf cat output ..\..\Export\Merged_reports.pdf<span class="line-numbers-rows"><span></span><span></span></span>
The pdftk software (Link) is a free program which helps working on pdf files.
Many thanks for your help.
Answers
-
Hi,
I assume, that the board User executing this procedure has the right "Allow execution of security critical procedures".
Nevertheless, depending which user account (system account, service user, etc) a different path is for the execution of the batch. From my point of view the easiest way would be to adress the files explicit (
del c:\board\Export\Merged_reports.pdf
) and not implicit (del ..\..\Export\Merged_reports.pdf)
</code></p><p><code>Futhermore PDFTK must be installed for all users (you can easily check, just open a CMD with Run as admin and use the PDFTK command)
</code></p><p><code>I hope this is helpful.
</code></p><p><code>regards
Björn
1 -
Thank you for your help,
I assume, that the board User executing this procedure has the right "Allow execution of security critical procedures".
correct, since the first step of the procedure (also a server-side command) runs properly.
Regarding the users:
- the BOARD user is Administrator (the first user in BOARD Server settings), it is a "password" user and I guess it is independent from the Windows user logics. I don't open the BOARD Software as an admin.
- the windows user (the one of my windows session) should have the rights to run pdftk, since the command
pdftk ..\..\Export\*.pdf cat output ..\..\Export\Merged_reports.pdf<span class="line-numbers-rows"><span></span></span>
works when I run it from the CMD (not as an admin in this case), shouldn't it?
Anyway your idea about user rights issue for the pdftk program must be correct, since BOARD runs the .bat file successfully when only this command is in the file:
del c:\board\Export\Merged_reports.pdf<span class="line-numbers-rows"><span></span></span>
so I don't understand why my windows user running pdftk from command line works, whereas the same script triggered by BOARD Client doesn't run.
3 -
Hi,
it's all about the user context.
If you start the program directly using a doubleclick is is running in your user context. If you are starting it from Board Engine it's using a different one.
For example if you start CMD it's pointing to your user account [in my case C:\Users\Björn Reuber], if you start CMD as an admin user it's a diffrent folder [C:\Windows\system32].
So when I start the procedure with run as admin it should navigate to
del c:\Export\Merged_reports.pdf
which doesnt make any sense.You can add a pause to your batch and test it using your user and with run as admin.
So the problem is more related to windows and should work if you're using an explicit comand.
Regards
Björn
3 -
regarding relative paths, I have tested the .bat file with one line only:
del ..\..\Export\Merged_reports.pdf<span class="line-numbers-rows"><span></span></span>
And then run the BOARD procedure calling the bat file. It worked. The PDF file has been deleted from the \Export folder.
1 -
So, I tested several things:
First work with absolute paths, as you suggested.
pdftk C:\BI\Export\*.pdf cat output C:\BI\Export\Merged_reports.pdf<span class="line-numbers-rows"><span></span></span>
and then open BOARD both a) as I am, and later b) as an administrator, using the same BOARD user.
In both cases, the command is not executed.
Then I added a pause in the script. The BOARD window "Running procedure..." stays running indefinitely and I must close BOARD manually. The CMD black interface did not pop up.
Using the CMD command a) as I am, and later b) as an administrator and run the script line with absolute paths worked in both cases...
2 -
Hi,
my fault, the pause command only was meant for the tests, not when it's executed by BOARD. But it seems that maybe the system account has no access to pdftk. Maybe a test would be to run the engine with your user account and test if the script is working.
Regards
Björn
2 -
at the end I gave up using pdftk and achieved my goal thanks to another thread here which uses a combination of Ghostscript and CPDF softwares.
I haven't solved the issue with pdftk software execution rights, but I chose this software to merge pdf files, which I did using Ghostscript. Therefore I close this thread.
Many thanks to Björn Reuber for helping here!
1
Categories
- All Categories
- 2K Forums
- 1.8K Platform
- 159 Academy
- 324 Resources
- 1 Board Knowledge Base
- 50 Best Practices
- 49 How-To Guides
- 19 Board Advocacy Program
- 191 Blog
- 4 Groups Hub
- 4 About Groups
- New Community Members
- DACH
- Japan
- 4 Community Captains
- 1 About Community Captains
- 2 Meet the Community Captains
- 1 Topics & Thought Starters
- Learn from the Board Captains
- Release Notes
- Academy
- 2 Board Academy
- 8 ILT/VILT Course Catalogue
- 13 e-Learning Course Catalogue
- 4 Academy Forum
- 1.2K Idea Exchange
- 337 Partner Hub
- 94 Support
- 14 FAQ's
- Customer Support Portal
- 54 Support Articles
- BEAP