vdrake
Posts: 12
Joined: Tue Aug 17, 2021 3:25 am

Prevent creating a user with a weak password during Wizard Dialogs phase

Fri Aug 20, 2021 8:08 pm

My installer may allow the user to create a local user account, providing a username and password.
However, if the user enters a new password that would fail password complexity requirements of the computer or domain, the install fails.
I would like to validate that the username and password will be correct for password policy early in the installer and allow the user to fix the problem, rather than failing later on.

I've found LogonInformationDlg and the "Check if user exists" custom action. These are great for confirming the user found and provided the correct password for an existing user. They also help the wizard offer the option of creating a user if the one they specified does not exist.

It seems like the only way I can do this is with a custom action that actually *creates* the local user, sets an error message if that failed, then *removes* the user so that AdvancedInstaller can perform its own built-in user creation after wizard dialogs are complete. Are there other options?

Liviu
Posts: 1026
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Prevent creating a user with a weak password during Wizard Dialogs phase

Tue Aug 24, 2021 8:51 am

Hello,

In regards to the password complexity check, unfortunately we don't have such an option.

However, I think that it can be done through a PowerShell script. You can set a property that stores the password in your dialog.
In order to retrieve a property value in a custom action (e.g. PowerShell script), you can use the following line:

Code: Select all

$var = AI_GetMsiProperty PASSWORD_PROP

Have a look on this article which details how to implement the password check in PowerShell: PASSWORD COMPLEXITY CHECK – #POWERSHELL

Then you can configure the Next button based on the script verification.

Also some articles which may help you:
- "Run Inline PowerShell Script"
- "How to set an installer property using custom actions"

Hope this helps! If you have any other questions, please don't hesitate to contact us.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”