Wednesday, February 13, 2013

More Deployment Tidbits!

One of the other challenges that IT Administrators face is that there are many applications out there that do not conform to operating system standards when being installed. This lack of conformity is usually the result of a few things:
  • The cost of 'doing it right' is too high for most development teams. People who know the underlying operating system cost more than your average code monkey. Most development processes (such as AGILE) encourage functionality and features over sound application design.
  • Developer ego. "I know better than Microsoft." "The registry sucks!"
As a great example, Java and Firefox do not lend themselves well to corporate deployment and management. Java, for example, uses a configuration file that is searched for under C:\Windows\Sun\. Not every option in the Java Control Panel is configurable through these configuration files, either.

So to you, I present the following guide:
  • Use the registry, religiously. I don't care if you think you're better than Microsoft. If you don't want to write a Windows application, then don't create one. But when you write for the Windows environment, USE THE REGISTRY. You wouldn't use $HOME/ to store application-level (system-wide) configurations in Linux, why would you not use Microsoft's conventions?
  • In Windows (Vista and above), system-wide application configuration and log files should go in C:\ProgramData\YourApplication. This location becomes your scratch space, and most importantly, C:\ProgramData is a high integrity location, which means it can only be accessed by users who are Administrators. (However, your subfolder is RW to your application).
  • HKEY_LOCAL_MACHINE\SOFTWARE is the place to store your application's system-wide preferences.
  • HKEY_CURRENT_USER\SOFTWARE is where you store configuration for the user installing the tool.
  • %USERPROFILE%\AppData\ is where you store user-specific things such as user-specific logs, user-specific downloads, and so forth.
  • %USERPROFILE%\AppData\Roaming is what you use if you wish to allow these things to be replicated with Windows Roaming User Profiles.
  • %USERPROFILE%\AppData\Local is the location you use when you do not wish for your application's data to be replicated, or it's not necessary to be replicated. For example, user-specific log data might not need to be replicated from machine to machine.
  • %USERPROFILE%\AppData\LocalLow is the location to be used when you run your application with a low integrity level (read: reduced system privilege). I encourage you to build your applications to run in this mode.