5 Replies Latest reply on Jun 17, 2009 8:18 AM by comment_1

    Batch Password Change

    MikeyG79

      Title

      Batch Password Change

      Post

      I'd like to change the administrator password to all the files in my solution (inherited a 90+ file/db product), wondering if there is a batch way to do this or some way to script it.

        • 1. Re: Batch Password Change
          TSGal

          MikeyG79:

           

          Thank you for your post.

           

          The "Change Password" script step allows you to change the password for the account.  Therefore, you could create a script that accesses each database file with the administrator account and change the password.  It may be something like:

           

          Open File [ <file 1> ]

          Change Password [ Old password: <old password> ; New password: <new password> ; No dialog ] 

          Open File [ <file 2> ]

          Change Password [ Old password: <old password> ; New password: <new password> ; No dialog ]

          ...etc.

           

          TSGal

          FileMaker, Inc.

          • 2. Re: Batch Password Change
            mrvodka
               Also when dealing with these many files, you may want to consider using External Authentication on the server.
            • 3. Re: Batch Password Change
              comment_1
                

              TSGal wrote:

              Open File [ <file 1> ]

              Change Password [ Old password: <old password> ; New password: <new password> ; No dialog ]


              I don't think you can use Change Password[] to change a password in another file. You need to call a script in the other file, and pass the old and new passwords to it as a parameter.


              • 4. Re: Batch Password Change
                TSGal

                mr_vodka:

                 

                Excellent point about External Authentication.  Thank you!

                 

                 

                comment:

                 

                Good catch!  I should have taken more time to verify this the first time.

                 

                 

                In the main file, put the old password and new password into a variable so it can be passed as a parameter.  For this example, I'm separating the old and new password with a hyphen.  If a hyphen is a character in your password, then use a different separator.

                 

                Assuming your files all have the standard "Admin" account with no password, and you want to change the password to "admin" in each file, the script may look as follows:

                 

                Change Password [ Old Password: "" ; New Password: "admin" ]

                Set Variable [ $var ; Value: "-admin" ]

                Open File [ <second file> ]

                Perform Script [ "Password Change" from file: <second file> ; Parameter: $var ]

                Open File [ <third file> ]

                ....etc.

                 

                The "Password Change" script in the second file may look like the following:

                 

                Set Variable [ $old ; Let ( a = Get ( ScriptParameter ) ; Left ( a ; Position ( a ; "-" ; 1 ; 1 ) - 1 ) ) ]

                Set Variable [ $new ; Let ( a = Get ( ScriptParameter ) ; Right ( a ; Length ( a ) - Position ( a ; "-" ; 1 ; 1 ) ) ) ]

                Change Password [ Old Password: $old ; New Password: $new ]

                 

                That is, take all information before the hyphen and store it in $old.  In this example, since there is nothing prior to the hyphen, a null string is stored in $old.  Then, take all information after the hyphen and store it in $new.  Finally, change the password. 

                 

                (I just tested this out to make sure it works.)

                 

                Let me know if you (or anyone) has additional comments.

                 

                TSGal

                FileMaker, Inc.

                • 5. Re: Batch Password Change
                  comment_1
                     I believe it could be simpler:

                  ...
                  Set Variable [ $parameter ; "myOldPassword" & ¶ & "myNewPassword" ]
                  Perform Script [ "Password Change" from file: <second file> ; Parameter: $parameter ]
                  Perform Script [ "Password Change" from file: <third file> ; Parameter: $parameter ]
                  ...



                  And the called script:

                  Change Password [ Old Password: GetValue ( Get (ScriptParameter) ; 1 ) ; New Password: GetValue ( Get (ScriptParameter) ; 2 ) ]