Get rid of copy and paste code in installer/ and unify them.

The powershell scripts had lots of duplication. Make the unified
code instead.
Original patch was provided by Craig Ringer.
Improve pgxalib.dll(MSDTC support).
1. Change xa_open() so that it tries to connect to the database immediately.
   This would cause an error at enlistment in dtc when the authentication
   method depends not only on the db user but also on the OS user and it
   means the automatic transaction recovery is unavailable.
2. Log the error message in case of SQLDriverConnect() error.
3. Improve the logging.