Just for the record:
I solved the problem by checking myself whether the user 'postgres'
actually exists before running the msi installer. I do this by running the
following WSH script doing an ADO query:
Private Function userExists ( ByVal domain, ByVal username )
' checks whether a certain user exists
' see
http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept05/hey0907.mspx
On Error Resume Next
Set objUser = GetObject("WinNT://" & domain & "/" & username)
If Err.Number = 0 Then
WScript.Echo "The user account '" & username & "' exists in the
domain '" & domain & "'"
userExists = 0
ElseIf Err.Number = -2147022676 Then
WScript.Echo "The user account '" & username & "' does not exist
in the domain '" & domain & "'"
userExists = 1
Else
WScript.Echo "The user account status of '" & username & "' in
domain '" & domain & "' could not be determined"
userExists = 2
End If
End Function
WScript.Quit(userExists(args(0), args(1)))
Explanation: Whenever this script exits with 0, the user does exists, and
I set CREATESERVICEUSER=0, otherwise 1.
If anyone knows about a more elegant solution, please let me know.
Regards,
Dirk.
pgsql-admin-owner@postgresql.org schrieb am 18.06.2007 09:09:59:
> Hi,
>
> the msi installer for Windows automatically creates a user 'postgres' if
> CREATESERVICEUSER=1. Is it possible to do the following:
>
> 1) don't create the user, if it already exists, and continue with
> installation, instead of showing the error message 'user postgres
already
> exists'.
>
> 2) during uninstallation, delete the user 'postgres' automatically, when
> it has been created during installation.
>
> Thanks,
> Dirk Moebius
--
Dirk Moebius
Software Consultant
MBB Gelma GmbH, Bonn, Germany
http://www.mbb-gelma.de/