Jump to content
Server Maintenance This Week. ×

Bug? System Level Script 'Aborts Unexpectedly' on FMS 13 Windows when called from a local user account


cjcj01

This topic is 3735 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi guys,

 

I'm on a Windows 2012 Server running FMS13.

 

I have written a simple .bat file which simply copies a .csv file from /data/documents/ to a server share.

 

Running the .bat in CMD prompt or Powershell successfully copies the file.

 

I've tried to set up a script schedule in FMS13.

 

I can see the .bat file in the drop down menu in step 1.

I have also added an admin user account to run the script by.

 

The event log gives me this error:

Error 154 TF_FMS2 Schedule "Batch Script" aborted; "ProcessCSVfiles.bat" could not be found or is invalid

 

 

I don't think this is a very helpful nor a true description.

1) The file does exists and has already be found.

2) It is not invalid as it runs correctly from the cmd prompt

 

The .bat file simply says this:

:Variables
SET PSFPath=sharenamefolder
SET inbox=C:Program FilesFileMakerFileMaker ServerDataDocumentsinbox
SET sent=C:Program FilesFileMakerFileMaker ServerDataDocumentssent

@echo off
FOR /F "delims=|" %%I IN ('DIR "%inbox%*.csv" /B /O:D') DO COPY "%inbox%%%I" "%PSFPath%" & MOVE "%inbox%%%I" "%sent%" & EXIT

i.e. it copies the latest file from the 'inbox' to a server share, then moves it to the 'sent' folder.  

 

I was thinking it was a permissions issues but... (edit: see post below)

--------------------------------

 

I've tried a few more things and think there's a problem with FMS13 using any account other than the default one... Here's why:

 

Here's my new batch script and i apologise for it's complexity:

echo test

 : ) And I've saved this as test.bat

 

 

Again, it comes up and I can select it in the drop down when setting up a new system-level script.

 

So, if I run this without ticking the 'use a User account rather than the default account', it runs OK.  As does copying my .csv file from a local folder to another local folder - the problem is, I need to copy it to the server/share and as far as I understand, for this I need FMS to run with a local account on the server which has privileges to access the share.  

 

But if I run the above text.bat with a 'User Account' - and for this I've set up a brand new account in the administrator group called FMServer - then I get the utterly frustrating 'Aborted Unexpectedly' message:

 

Error 154 TF_FMS2 Schedule "Batch Again" aborted; "test.bat" could not be found or is invalid.

 

 

Again, given that this file:

 

1) Can be found

 

2) Is valid (as it runs without the user account selected)

 

means that the above is a very poorly constructed error message.

 

I have tried using both just username and computername/username as per the instructions for Windows in the server help.  There also appears to be no 'Validate Account' option in the FMS13 admin panel as there was in previous versions.  And FMS doesn't seem to be able to validate any account to run a system level script.

 

Can anyone else test this on a different instance? 

 

I think this needs to be fixed before I can troubleshoot my script for problems which seems to otherwise run fine.

Link to comment
Share on other sites

The .bat file simply says this:

 

 

As a work around (although it still doesn't solve the problem with FMServer not running locally authenticated server side scripts) you can get the above working by running the system level script from Windows task scheduler... (although it doesn't then work in tandem with FMS which is minor pain)

 

However, for those needing to work with server/shares the change you will need to make is to PushD to change directory to the server/share first, otherwise you won't be able to make a the copy of the file as you can't use a UNC path in a scheduled script  e.g.:

@echo off

:Variables
SET serverPath=servershare
SET inbox=C:Program FilesFileMakerFileMaker ServerDataDocumentsIMPACTUK_GRANTPAYMENTSinbox
SET sent=C:Program FilesFileMakerFileMaker ServerDataDocumentsIMPACTUK_GRANTPAYMENTSsent


if exist "%inbox%*.csv" (
 PUSHD "%serverPath%"
 FOR /F "delims=|" %%I IN ('DIR "%inbox%*.csv" /B /O:D') DO COPY "%inbox%%%I" & MOVE "%inbox%%%I" "%sent%" 
 POPD
) 
Exit

Nope, I don't really understand the UNC bit either, but here's some references:

http://stackoverflow.com/questions/12513264/batch-runs-manually-but-not-in-scheduled-task

http://en.wikipedia.org/wiki/Path_%28computing%29#UNC_in_Windows

 

Essentially the PushD takes you to the server/share and sets it as your current working director so you can copy the file there, otherwise the CMD process doesn't understand the serverPath reference.

Link to comment
Share on other sites

TSGal has answered this question here:

http://forums.filemaker.com/posts/eaa7e3dbf4

Basically, to get a system level script running, you simply need to add . before the username on windows.  So simple when you know how.

So the script now runs but doesn't copy to the servershare so I think I need to add a domain account to run the script by rather than a local user account.  Or just leave it running divorce in Task Scheduler.  

Link to comment
Share on other sites

This topic is 3735 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.