# How to run a batch file by FME Server

I created a batch file, which executes a .fmw workspace on FME Desktop. I want this batch file to get started by the FME Server. So I created a simple workspace with a SystemCaller transformer, which calls the .bat.
Running that workspace on FME Desktop works perfectly.
As soon as I upload and run the workspace to the FME Server the logfile returns following error:

SystemCaller: Failed to Execute \\*my UNC_Path*\start_fme.bat'


I granted a full access permission to the server and used a UNC-path to the .bat. On other projects I'm already using UNC-paths on FME Server workspaces to local data in the same directory as the .bat, so the connection between server and network drives is definitely working.
Any ideas, what I might have done wrong or might have forgotten?

OK, so I checked into this and you should be able to get this to work as long as you surround the command in double quotes. For example:

""C:\Python27\python.exe" "C:\scripts\C119009.py""
`

I do think that in a case like this there's very little reason to not have the parent workspace run the worker on FME Server itself using an FMEServerJobSubmitter transformer. Having the parent use a SystemCaller to run a bat file to run the worker workspace on Desktop just seems an odd way of doing things.

• + UNC paths needs a user account (rather than Local System account) – Mapperz Nov 19 '18 at 20:01
• Thank you, but despite I surrounded the path in double quotes, it is still not working. The reason I need to run the workspace on Desktop is the lack of an internet connection on the FME Server. The workspace contains a geocoder, so I definitely need the web connection. The Server has the purpose of an directory watch and triggering the desktop workspace, as soon as a change was made. – pascatl Nov 20 '18 at 8:00
• I don't think the UNC path is the problem. I granted full access to the local system account and its working, when e.g. a reader on a server workspace is refering on a network drive. Why might the UNC path work with readers, but with SystemCaller transformer not? – pascatl Nov 20 '18 at 8:03
• Can you try using the SystemCaller to run a really simple command - for example something like cls or similar. Something that doesn't need an argument or UNC path. Let's see if we can get any command to work. Then try running a batch file locally to see if that works. I guess there are just a few steps to test before being able to say whether the UNC part is the problem. Edit: Actually hostname would be better than cls - just as simple but actually returns a value we can check. – Mark Ireland Nov 20 '18 at 15:32
• ok, I tried several things: (test.bat: creates an empty .txt on specific path // start_fme.bat: runs a FME workspace: \\servername\c\$\apps\FME\fme.exe \\servername\path\to\test.fmw) what works: - running the test.bat located on a network drive by FME Server. what does not work: - running the test.bat located on C: - running the start_fme.bat – pascatl Nov 26 '18 at 9:50

I found a workaround for the problem I specified above.
It's not exactly the answer to my previous question, so I won't mark it as solved, nevertheless I want to share with you a possible way, maybe it helps someone else.

Main goal: A FME process should be started on desktop as soon as a change was made on a specific .xlsx-file.
Previous solution trial: FME Server does a directory watch on that file, as subscription it starts a process with SystemCaller in it, which executes a batchfile on the desktop.
Cause of failure: FME Server apparently does not have the permission to execute the batchfile.

Workaround:
I'm still using the directory watcher running by the FME Server, looking for changes made on the xlsx-file.
As subscription the FME Serve creates a trigger.txt on my local directory. Additionaly I created a monitoring task as powershell-skript, looking for that trigger.txt. Whenever the task gets triggered, it executes the batchfile executing the FME Desktop workspace. For sure that's not the most elegant solution, but it works.