Failed to grant 'logon as service' rights to user.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Failed to grant 'logon as service' rights to user.

vasyl
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Hi. I have the installer that includes services.
I added this component to grant 'logon as service' rights for user:

 <Component Id="CMP_GrantUserLogonAsAService" Guid="*" Directory="APPLICATIONFOLDER" Transitive="yes">
      <RegistryValue Root="HKLM" Key="Software\TheProject\Install"
                     Name="LogonAsServiceRightGivenToUser" Type="string" Value="1" KeyPath="yes" />
      <util:User Id="UpdateUser_GiveLogonAsServiceRight" UpdateIfExists="yes" CreateUser="no" Name="[SERVICE_USERNAME]" LogonAsService="yes" />
    </Component>

I have a user on local pc "user1". The component works perfectly if I enter just username.
But when I try to input username like this:
".\user1" i get an error:

Failed to grant 'logon as service' rights to user.
(-2147023564 .\user1     )

It's quite strange behaviour and I cant recognize the reason of such problem. Can somebody help me?
Reply | Threaded
Open this post in threaded view
|

Re: Failed to grant 'logon as service' rights to user.

Phill Hogland
This post has NOT been accepted by the mailing list yet.
ServiceInstall/@Account requires the 'downlevel' NetBios formated credentials in the form domain\account, and in that form when a period is used it indicates the local computer as the domain.  However util:User requires that util:User/@Account be the DNS user name only and that the domain be specified in util:User/@Domain.  This difference may seem strange but is related to the different underlying Windows APIs which are called.
Reply | Threaded
Open this post in threaded view
|

Re: Failed to grant 'logon as service' rights to user.

vasyl
This post has NOT been accepted by the mailing list yet.
I see. Thank you for the answer. But it is still not clear for me how can I handle it?
Before installation of services user manually enters credentials which are tested (with LOGON32_LOGON_INTERACTIVE)
This dialog applies
".\username"
as well as "domainname\username"
and just "username" (for local user of course)
But further installation fails if credentials were entered in this way ".\username"
Reply | Threaded
Open this post in threaded view
|

Re: Failed to grant 'logon as service' rights to user.

Phill Hogland
This post has NOT been accepted by the mailing list yet.
In my case I use a Burn mba to drive my msi and in the mba I parse the user input and set properties for the msi so that I pass a property to the ServiceInstall element in the 'down level' format (replacing the period if it exists with the name of the local computer), and I pass separate properties for domain and account to the msi for the util:User elements.  If using the Burn StdWixBa a bafunctions.dll could be used to parse the user input.  And I assume in all cases whether using Burn or just using an MSI an immediate CA could be used to parse the input and set different properties used by the ServiceInstall verses util:User elements.
Reply | Threaded
Open this post in threaded view
|

Re: Failed to grant 'logon as service' rights to user.

vasyl
This post has NOT been accepted by the mailing list yet.
Thank you. Your answers were really helpfull.
According to your advice i just published another property, made a customAction to replace ".\\" in the beginning of username with "computername\\" and then I passed this property to util:User.
It works fine.
Thank you again.