Re: RESOLVED: msi installer: CREATESERVICEUSER and uninstall

From: Dirk(dot)Moebius(at)dorma(dot)com
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: RESOLVED: msi installer: CREATESERVICEUSER and uninstall
Date: 2007-06-25 08:02:39
Message-ID: OF296E8282.8BFE973F-ONC1257305.002C249D-C1257305.002C342E@dorma.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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(at)postgresql(dot)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/

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Jerry Crocker 2007-06-25 10:06:22 pgAdminIII via VPN
Previous Message Jeff Frost 2007-06-25 03:08:58 Re: Upgrade from 8.1.4 to 8.1.9