Hi to all.
I usually install Postgresql on my user to local development using the Postgresql Binaries
I follow some tips from this link Installing Postgresql 9.1 to windows 7 from the binary zip distribution
You could do this installation and definitons programmatically, but you must define a user to run postgres at end.
In my case I use my own linux account.
Always work.
Hope its helps
Samuel