« Office view this week… | Home | MBS FileMaker Plugin,… »

Tip of the day: Query connected clients on FileMaker Server by script

Today at a visit of Team Nifty, we talked about FileMaker development, deployment, iOS, Server and a lot of more things. While discussing import and export of data and coded a few new plugin functions. So I added two new useful functions to parse and format dates, times and timestamp in any way. Time.Format takes a timestamp and formats it in the way you specify. The other way around Time.Parse takes a text and parses a date. You can specify formats exactly and read/write dates, times and timestamps in the format you need.
Patrick Weh show me a nice way to figure out what clients are connected to a FileMaker Server. He runs a script which uses a shell command with our RunTask functons to ask the server via the fmsadmin tool for the list of connected users:

# © 30.07.2016 Patrick Weh | Team Nifty GmbH (17:40 Uhr)

# List connected Clients

# ------------------------------------------------------------------------------------------------------------

# Script checks for connected clients at the FileMaker Server.

# Copy this File to your Server and run this Script on your FileMaker Server.

# ------------------------------------------------------------------------------------------------------------


Set Error Capture [On]

Allow User Abort [Off]


Set Variable [$r; Value:MBS( "RunTask.NewTask" )]

Set Variable [$r; Value:MBS( "RunTask.SetLaunchPath"; "/Library/FileMaker Server/Database Server/bin/fmsadmin" )]

# please put your admin password here

Set Variable [$r; Value:MBS( "RunTask.SetArguments"; "-u" ; "fmserveradmin" ; "-p" ; "fmserveradminpassword" ; "list" ; "clients" ; "-s" )]

Set Variable [$r; Value:MBS( "RunTask.Launch")]

# now wait for task to finish:

Set Variable [$result; Value:""]


Pause/Resume Script [Duration (seconds): 2]

Set Variable [$result; Value:$result & MBS("RunTask.ReadOutputText")]

Exit Loop If [MBS("RunTask.IsRunning")  ≠ 1]

End Loop


# write into a field:

Set Field [Check clients::Clients; $result]

Commit Records/Requests [No dialog]


Of course this script must run on the FileMaker server, either as scheduled script, perform script on server or as part of a FM Pro on the server machine.
17 08 16 - 21:10
two comments

Nice, but does not this keep the server occupied? The 2 second pause has me worried a bit. Can you clarify? Thanks
Maarten Witberg (URL) - 17 08 16 - 21:23

Well, you can run FM Server with several scripts in parallel. No problem.
The 2 second pause is just to let fmsadmin start and do it’s job.
Christian Schmitz - 17 08 16 - 21:35

Remember personal info?

Emoticons / Textile

Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.