Ick! Surely the path to the application / config files is available in the registry? Why is it inconsistant?

As you say, you have a major problem with your script if the files are in more than one place - only one will get updated.

If you really want to persevere with the manual find,
  • Assign the paths to an array.
  • loop through the array and do the work for each file found.