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.
Add time zone dexpression to the text output form of TIMESTAMP WITH TIME ZONE data.