5 Replies Latest reply on Apr 18, 2013 2:54 PM by BowdenData

    Accessing External Files for Import in Server-side Scripts on FMS12

    kmtenor

      I have a need to import an Excel sheet on a daily basis (FMSA12/Windows 2008R2). The file in question is already being placed on a network share by an administrator in our office, and I have no desire to ask her to add to her process and have her do something "special" in order for Filemaker to get its hands on this data. Unfortunately, the file's location and name are dynamic (but formulaic) so the only way to access it on a daily basis is via a $filename variable in the Import Records script step.

       

      I see in other forum posts and on fmforums.com that previous versions of Filemaker server are not able to access files stored outside of the Filemaker Server security "bubble", and so any file to be imported by a Server-scheduled script is required to be accessible within the "Documents" folder of the Server installation. However, I cannot find any documentation that this has - or has not - been addressed with the introduction of Filemaker Server 12.

       

      From testing, I can see that the limitation appears to be present - I get a 100 error in the logs every time the script runs from the server. However, I have seen vague references in some posts that make me think that, were I to change the account name under which Filemaker Server is running to a domain-based name rather than "Local System", I might have some success accessing files for import that are located on other (remote) volumes.

       

      Since changing the Log On account for server is somewhat disruptive, it's worth asking here first, to see if anyone else has overcome this limitation by changing the Log On account, or by some ther method. If not, or if it's not possible, is anyone else interested in this feature? Is it worth sending in a request to have it changed, or is this a security limitation that we just have to live with by continuing to run a "robot" server?

       

      Thanks in advance.

       

      -Kevin

        • 1. Re: Accessing External Files for Import in Server-side Scripts on FMS12
          BowdenData

          Kevin,

           

          Scripts that run on the FM server can only see the FM Documents folder and the OS Temp folder. No change with FMS12.

           

          One idea is the setup a script sequence task with a 'before' OS script. In setup of the script sequence task, you can specify an account to run the OS script with. Make sure the account you specify has the privs needed to access the file share as well as the FMS Documents folder. The OS script would have the logic to grab the desired file off of the file share and copy it into the FMS Documents folder. Then the actual FM script would run and be able to use the Excel file. The beauty of doing a script sequence is that you don't have to worry about timing multiple scripts. If needed, you could also have an 'after" OS script that might cleanup by deleting the Excel file or whatever.

           

          You can find more info about script sequences in the FMS documentation.

           

          Doug

          • 2. Re: Accessing External Files for Import in Server-side Scripts on FMS12
            kmtenor

            Thanks, Doug.  I'll definitely give that a closer look.

             

            -Kevin

            • 3. Re: Accessing External Files for Import in Server-side Scripts on FMS12
              BowdenData

              Kevin,

               

              Forgot to mention that in the OS script, you will need to use UNC file reference formats for any files on the file server. When running on the FM server, it doesn't know anything about mapped drives.

               

              Doug

              • 4. Re: Accessing External Files for Import in Server-side Scripts on FMS12
                kmtenor

                Thanks, Doug.

                 

                I was already thinking about that.  Also going to have to figure out if I'm stuck with good 'ol .bat files, or if I can dip a toe into PowerShell.

                 

                If I'm stuck with .bat, we have employed strategies before where we actually mount a share as a mapped drive (net use x: <UNC PATH HERE>), and then destroy it when we're done (net use x: /delete).  That way, we can shorten the sequences where we actually do the copying.  I'm hoping, though, we can use this as an opportunity to learn PowerShell.  The path to get to the file changes, as well, so we have quite a bit of dynamic work that will now need to be duplicated in the OS-level script that we've already done in the FM script. I'm not exactly excited about doing date parsing in a batch file!

                 

                Never a dull moment, but at least there are ways to work it.

                 

                Thanks again.

                 

                -Kevin

                • 5. Re: Accessing External Files for Import in Server-side Scripts on FMS12
                  BowdenData

                  Kevin,

                   

                  I am guessing that mapping drives in your OS script should work, but I have never tried it. I too, am unfamilar with Powershell. If I were doing this, I would likely use VBScript over a .bat file. Even though I only have basic knowledge of VBS, I find that there are tons of examples on Microsoft's site as well as others. Pretty easy to find code to do what you want. Maybe Powershell is also good in this regard...

                   

                  Doug