0

I am adapting a program I wrote to run at user login in the system tray to do it's work as a service while another instance may run in the tray for configuration access. The plan being to save any changes when made and restart the service with the new configuration.

In my original program I used project settings to store my configuration ([MyProjectName].Properties.Settings.Default). When it is run as a service it uses the local system user account which means it has different settings than when run with access to the tray.

Before I move to a different configuration strategy, is it possible to change the settings for the local system account from my instance run as a normal user?

Fr33dan
  • 4,227
  • 3
  • 35
  • 62

1 Answers1

0

It is possible to modify the settings file of another application by parsing its configuration file. You will need write permissions for wherever that file is stored. You could grant these to your normal user account on runtime.

However, I think that directly modifying another applications settings file is a pretty hacky way to do it. It would be wiser (and probably easier) to store the configurations in a more standardized location that can be easily accessed by both applications, like ProgramData or Program Files

Community
  • 1
  • 1
MrZander
  • 3,031
  • 1
  • 26
  • 50
  • Yeah that is a hacky way of doing it. I was hoping there was some function like `GetSettingsOfUser(user)` that I was simply unable to find. – Fr33dan May 12 '17 at 16:09
  • @Fr33dan FYI, the settings are only user-specific if you specified `user` as the scope. Further, even if you do specify user, they still are application-specific (in that, you would need to know more than just the user to get to those settings). Good luck! – MrZander May 12 '17 at 16:15
  • Well it's the same application/executable so that isn't an issue. But with the application scope they are not changeable at runtime which defeats the purpose altogether. I ended up placing the configuration in ProgramData. – Fr33dan May 12 '17 at 21:29