hsc
Posts: 71
Joined: Wed Mar 02, 2016 2:55 pm

CheckIfUserExists action

Wed Nov 28, 2018 8:25 pm

I have a dialog where the user can enter Windows credentials during installation. My goal is to verify these credentials and only let the user proceed to the next dialog if they are correct.

To achieve this, I added the following "Published event" to the dialog's "Next" button:
- Execute custom action "CheckIfUserExists"
Further, to the predefined event "Display a specific dialog", I added the condition

Code: Select all

(AI_USER_EXIST="Yes" AND AI_USER_VALID_PASSWORD="Yes")
.
I must have gotten something wrong because I never get beyond this dialog.

For debugging, I added a text control to the dialog. Its property name is TEXT_6_PROP (by default) with the default content "Text". I added the following event to the "Next" button:
- Set installer property value TEXT_6_PROP, argument=[AI_USER_EXIST]
and, just to be on the safe side:
- Refresh the current dialog
However, the text control remains at "Text" all the time although AI_USER_EXIST should be either "Yes" or "No" when I click the "Next" button. What's wrong?

By the way, I suspect that the problem may be that the USER_NAME variable contains a string like "domain\username", but that is another problem that can be addressed later.

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: CheckIfUserExists action

Thu Nov 29, 2018 2:10 pm

Hello,

Please be aware that the property name which stores "Yes" or "No", depending on whether the user exists or no is:

Code: Select all

AI_USER_EXISTS
not

Code: Select all

AI_USER_EXIST
Can you please change that within your condition and let me know if that helps?

Kind regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

hsc
Posts: 71
Joined: Wed Mar 02, 2016 2:55 pm

Re: CheckIfUserExists action

Tue Dec 04, 2018 12:02 pm

Sorry, it took me quite a while to get back here, I had other jobs to do, but now I'm returning to this issue. I found out that my call to the "Check if user exists" action always returns AI_USER_EXISTS="No" (AI_USER_EXIST was just a type in my previous post) even though I definitely know that the user exists (e.g. "LocalSystem" which always exists, or the AD user with which I am currently logged on). The log file is not too talkative, it contains these lines:

MSI (c) (08:CC) [11:54:04:052]: Doing action: VerifyServiceUser
Action 11:54:04: VerifyServiceUser.
Action start 11:54:04: VerifyServiceUser.
MSI (c) (08:70) [11:54:04:052]: Invoking remote custom action. DLL: E:\Temp\MSIFF9D.tmp, Entrypoint: CheckIfUserExists
MSI (c) (08!B4) [11:54:04:067]: Note: 1: 2205 2: 3: AI_UserAccounts
MSI (c) (08!B4) [11:54:04:067]: Note: 1: 2228 2: 3: AI_UserAccounts 4: SELECT `UserName` FROM `AI_UserAccounts` WHERE `UserName` = ?
MSI (c) (08!B4) [11:54:04:067]: PROPERTY CHANGE: Modifying AI_USER_EXISTS property. Its current value is '1'. Its new value: 'No'.
Action ended 11:54:04: VerifyServiceUser. Return value 1.

(I renamed the custom action into "VerifyServiceUser".) Is it possible to enhance the log with the domain/username information? (These strings aren't case sensitive, or are they?)

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: CheckIfUserExists action

Wed Dec 05, 2018 12:23 pm

Hello,

First of all, the LocalSystem account is a predefined local account used by the service control manager. This account is not recognized by the security subsystem, so you cannot specify its name in a call to the LookupAccountName function. The LookupAccountName function accepts the name of a system and an account as input and retrieves the SID (security identifier) for the account and the name of the domain on which the account was found. With that being said, this is the reason why the "AI_USER_EXISTS" property has a value of "No" when searching for the "LocalSystem" "user".

In what regards the Active Directory user, I am not sure why that happens. I have tested this and it worked as expected. Can you please make sure that the domain name is written correctly?

Also, in what regards your last question, no, they are not case sensitive.

In order for me to further investigate this, can you please send me a copy of your .AIP file (project file) at support at advancedinstaller dot com? You can simply strip down your project to a basic size (it can contain only the custom action) and send it over (Important: make sure it is buildable).

Kind regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

hsc
Posts: 71
Joined: Wed Mar 02, 2016 2:55 pm

Re: CheckIfUserExists action

Wed Dec 05, 2018 1:28 pm

Hi Catalin,

thank you for replying. So I'll have to implement special treatment for the LocalSystem user, and probably for LocalService and NetworkService as well (these are likely candidates as well). Regarding the domain user, I've stripped down the project, and you'll have my email in a few minutes.

Hans

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: CheckIfUserExists action

Thu Dec 06, 2018 4:55 pm

Hello Hans,

First of all, thank you for your patience on this and also for the sent files.

This, indeed, seems to be an issue in what regards Advanced Installer (but to be honest with you, I can not tell you for sure until I talk to the development team).

Usually, users use this custom action together with the "LogonInformationDlg" (which is similar to the custom dialog which you created, but simpler). The "Name" and "Domain" fields from the "CheckIfUserExists" custom action are associated with the "User Name" and "Domain" edit controls on "LogonInformationDlg", which have the following properties:

- USER_NAME
- DOMAIN_NAME


So, to avoid this behavior, you can change the properties for the controls associated with the "Debug: domain" and "Debug: user" from:

- SERVICE_USER_NAME --> USER_NAME
- SERVICE_USER_DOMAIN --> DOMAIN_NAME


and also leave the "Domain:" and "Name: fields empty (from the "VerifyServiceUser" custom action ["Custom Actions" page]).

Also, I also noticed that you have a PowerShell custom action which modifies the value of the "SERVICE_USER_DOMAIN" and "SERVICE_USER_NAME" properties whose names were earlier changed. You may need to change its content (custom action's content) in order to match the newly named properties.

Also, I will attach the modified sample in the mail for your reference.

Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

hsc
Posts: 71
Joined: Wed Mar 02, 2016 2:55 pm

Re: CheckIfUserExists action

Thu Dec 13, 2018 3:44 pm

Thank you Catalin for your help. Renaming the variables to USER_NAME and DOMAIN_NAME solved most problems, and then I build special treatment for user names LocalSystem, LocalService, and NetworkService into the script which parses the username into name and domain. Still I wonder what must be the name of the variable that contains the password as input to the CheckIfUserExists action.

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: CheckIfUserExists action

Fri Dec 14, 2018 9:13 am

You are always welcome, Hans.

I am really glad I could help.

In what regards your second question, I think that it may be the same as it was with the earlier properties, so I would suggest to use the property which stores the password in the "LogonInformationDlg". That property is:

Code: Select all

USER_PASSWORD
Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

hsc
Posts: 71
Joined: Wed Mar 02, 2016 2:55 pm

Re: CheckIfUserExists action

Wed Dec 19, 2018 12:38 pm

Works now! Merry Christmas and thanks for all he help!

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: CheckIfUserExists action

Wed Dec 19, 2018 1:28 pm

You are always welcome, Hans.

I am glad I could help.

Merry Christmas to you, too!

Kind regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: CheckIfUserExists action

Thu Jun 06, 2019 12:56 pm

Hello,

An improvement for the "Check if user exists" custom action has been added in version 16.0 of Advanced Installer released on May 28th, 2019.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

hsc
Posts: 71
Joined: Wed Mar 02, 2016 2:55 pm

Re: CheckIfUserExists action

Fri Jun 07, 2019 1:21 pm

Great, I'll check this out later!

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: CheckIfUserExists action

Fri Jun 07, 2019 1:40 pm

Hello Hans,

Thank you for your followup on this.

Sure, please let us know what the user experience is now (if it is more clear for you, as a user, what "to do" with this dialog). As we have talked in the past, it wasn't so intuitive for the user that he should use the "DOMAIN_NAME"/"USER_NAME" properties (which are defined in the "LogonInformationDlg").

As you will see, we are now specifying that the two properties from above should be used. Hopefully, this will enhance the user experience and it will be more intuitive for further users facing a similar scenario.

Your feedback on this is highly appreciated since it is thanks to you that we were able to improve this.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”