11 Replies Latest reply on Jan 15, 2016 1:03 PM by TSGal

    Not all system-level scripts on FMS14 on windows will run succesfully

    Menno

      Product and version FileMaker Server 14.0.4)

      OS and version Windows 2008 R2

      Description

      A scheduled system-level script is aborted. The FMS-log says:


                          Schedule "xcopysomefiles" aborted; "xcopysomefiles.cmd" could not be found or is invalid.


      The script is run as user Administrator who has all rights to all folders on the server and has sufficient rights to the place in the network files are copied from. This works perfectly when run from the scripts-directory within the FMS-installation, either by double-clicking or by running it from the commandline.

      How to replicate

      The contents of the script are:


                          @echo off

                          xcopy \\SAMBASERVER\Data\SomeFolder\*.* "C:\Program Files\FileMaker\FileMaker Server\Data\Documents\"


      Create a schedule in FMS to run a "system-level script" and run under a user with administrative rights. It is also possible to run this script as the default-user (System) but that will result in another error:


                        Schedule "xcopysomefiles" aborted; system script "xcopysomefiles.cmd" returned non-zero status 4.

       

      Schedule this to run as an administrator on the system and the result is:

       

                        Schedule "xcopysomefiles" aborted; "xcopysomefiles.cmd" could not be found or is invalid.


      Workaround None


      Additional Info I also have a system-level script on the same server that run as the default-user and that run perfectly. That script tells the fmsadminconsole to write some data to a logfile:


                         cd "%programfiles%\FileMaker\FileMaker Server\Database Server\"

                         fmsadmin list clients -u admin -p qwerty > ..\Data\Documents\log.txt


      so it looks like it has something to do with the contents of a system-level script

        • 1. Re: Not all system-level scripts on FMS14 on windows will run succesfully
          Menno

          I can add to Product and version: FileMaker Server 13.0.5/9/10

          So this problem is not new, it just hasn't been noticed thus far. It is also not possible to work around it from the FMS perspective. Maybe by defining a schedule in the Windows-Task-Scheduler will work fine, but I will have to examine that in my situation.

          • 3. Re: Not all system-level scripts on FMS14 on windows will run succesfully
            TSGal

            Menno:

             

            Thank you for your posts.

             

            A similar issue was reported using a local user account.  However, since you are reporting this with an administrator account, I have forwarded all of the information to our Development and Testing departments for review.  When I receive any feedback, I will let you know.

             

            TSGal

            FileMaker, Inc.

            • 4. Re: Not all system-level scripts on FMS14 on windows will run succesfully
              TSGal

              Menno:

               

              In your statement, "Create a schedule in FMS to run a "system-level script" and run under a user with administrative rights", Testing would like to verify the FileMaker Server process is running as the user specified.

               

              Testing also mentioned that there are some commands used in batch file that FileMaker Server will abort no matter how the FileMaker Server process is configured.  For example, using the Start or Open command.  Also, Testing recommended adding the full path to Xcopy in the batch file.

               

              TSGal

              FileMaker, Inc.

              • 5. Re: Not all system-level scripts on FMS14 on windows will run succesfully
                Menno

                fmserver is running under the system-account which is the default at installation of fms.

                 

                the fms-schedule runs the .cmd/.bat file as the user Administrator of the windows-server. That user is actually an administrator.

                 

                the paths used are the full-paths, with a wildcard *.* for the filenames and a full local path to the documents-folder of fms (look at my OP please for refrence). This functions flawless when double-clicking on the script in windows-explorer as the user Administrator, without having to confirm the execution of the script....... the contents of the actual script are in the OP. No open or start commands at all, just one xcopy.

                • 6. Re: Not all system-level scripts on FMS14 on windows will run succesfully
                  TSGal

                  Menno:

                   

                  Thanks for the clarification.

                   

                  The information has been sent back to the Tester for review.

                   

                  TSGal

                  FileMaker, Inc.

                  • 7. Re: Not all system-level scripts on FMS14 on windows will run succesfully
                    TSGal

                    Menno:

                     

                    I apologize for the late reply.

                     

                    You said,

                    >the fms-schedule runs the .cmd/.bat file as the user Administrator of the windows-server.

                    >That user is actually an administrator.

                     

                    When using the Run As user on scripts that use credentials on a domain, it is best to have the FileMaker Server process run as that user.  Therefore, Testing wants to confirm that you are indeed running the FileMaker Server process as Administrator.  It will not work otherwise.

                     

                    TSGal

                    FileMaker, Inc.

                    • 8. Re: Not all system-level scripts on FMS14 on windows will run succesfully
                      Menno

                      So what you are saying is that I should run FMS as the administrator in order to be able to run a "system level script" that does tasks outside the usual realm of FileMaker Server?

                       

                      I will try that and will let you know my findings.

                      • 9. Re: Not all system-level scripts on FMS14 on windows will run succesfully
                        Menno

                        OK I tried your suggestion:

                        Then I checked my script to make sure the script runs as administrator too:

                        ScriptAsAdminstrator.png

                        And then I ran the script:

                        ResultAsAdministrator.png

                        It says "script missing".

                        If I change this to run as the default user it says "system script error"

                        ResultAsDefaultUser.png

                        As long as a script operates within the boundaries of just the data-folder in the FMS-installation, it seems to run fine. As soon as a location outside the FMS-folder is polled, the script will not work exit with one of these two errors.

                        • 10. Re: Not all system-level scripts on FMS14 on windows will run succesfully
                          TSGal

                          Menno:

                           

                          Thank you for the additional information.  I've sent the information about the script not operating outside the FileMaker Server installation back to Development and Testing for review.

                           

                          TSGal

                          FileMaker, Inc.

                          • 11. Re: Not all system-level scripts on FMS14 on windows will run succesfully
                            TSGal

                            Menno:

                             

                            Testing says this remains as a user configuration error within the script.  Testing has been kind enough to create a simple script that connects to a remote resource using a Domain user name/password, and copies files from the OS to the Network volume.  See below.

                             

                            TSGal

                            FileMaker, Inc.

                             

                            -----

                             

                            @echo off

                             

                            SET FMSPASS=a

                            SET FMSUSER=a

                            set log=c:\fmslog

                            set backup=c:\backup

                             

                            REM Set below password for your network user

                            set PASS=

                             

                            set MYDB="C:\Program Files\FileMaker\FileMaker Server\Data\Databases"

                            if NOT EXIST %MYDB% (

                                  set MYDB="C:\Program Files (x86)\FileMaker\FileMaker Server\Data\Databases"

                            )

                             

                            set ADMSRV="C:\Program Files\FileMaker\FileMaker Server\Database Server\fmsadmin.exe"

                            if NOT EXIST %ADMSRV% (

                                  set ADMSRV="C:\Program Files (x86)\FileMaker\FileMaker Server\Database Server\fmsadmin.exe"

                            )

                             

                            if not exist %log% mkdir %log%

                            if exist R: GOTO disconnect

                            if not exist GOTO network

                             

                            :Network

                            REM Use below when not logged on to DOMAIN

                            REM Uncomment below option and insert DOMAIN & USER (for non DOMAIN MACHINE ACCOUNT logon)

                            REM net use r: \\xx.xx.xx.xx\share /u:DOMAIN\USER %pass%

                             

                            REM Use below when logged on to DOMAIN

                             

                            REM net use r: \\xx.xx.xx.xx\Public

                             

                            REM Start r:

                            Erase /F /S /Q %backup%

                            rmdir / S /Q %backup%

                            mkdir %backup%

                            date /T >>%log%\file_info.txt

                            time /T >>%log%\file_info.txt

                            xcopy /S /E /V R:\testdb\. %backup%\. >>%log%\file_info.txt

                             

                            REM Pause FMS database files

                             

                            date /T >>%log%\file_info.txt

                            time /T >>%log%\file_info.txt

                            echo "Pausing for 5 seconds before backup..." >>%log%\file_info.txt

                            ping localhost -n 5 > nul

                            echo "Pausing all hosted database files before backup to Network drive..." >>%log%\file_info.txt

                            %admsrv% -u %FMSUSER% -p %FMSPASS% pause >>%log%\file_info.txt

                             

                            ping localhost -n 10 > nul

                             

                            echo "Starting backup..." >>%log%\file_info.txt

                            xcopy /E /V /C /H /K /Y %MYDB%\. R:\testdb\. >>%log%\file_info.txt

                             

                            echo "Successfully copied FileMaker Pro Databases from Server to Network drive..." >>%log%\file_info.txt

                            echo "Resuming below paused files..." >>%log%\file_info.txt

                            %admsrv% -u %FMSUSER% -p %FMSPASS% resume >>%log%\file_info.txt

                             

                             

                            REM net use /del r:

                            GOTO exit

                             

                            :DISCONNECT

                            date /T >>%log%\file_info.txt

                            time /T >>%log%\file_info.txt

                            Echo "Already connected to R:" >>%log%\file_info.txt

                            Echo "Disconnecting and using new credentials" >>%log%\file_info.txt

                            net use /del R: >>%log%\file_info.txt

                            GOTO network

                             

                            :EXIT