We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Check if Input in Dialog is valid

Hi,
I'm currently building an installer, where the customer can choose an instance name for SQL Server and a password for the sa user.

My questions is, how can I verify that the customer's input (in the dialog) is valid?

two examples:
    1. Check if the entered SQL instance name is allready used. I know where to look up in registry, but how can I read a registry value in dialog? Or is there a bettwer way than searching in registry?
    • Check if Windows Group Policy is configured that 'passwords must meet the complexity requirements'. If yes, check if the entered password is valid. Is something like that possible?
2018-12-27 16_12_37 Password Complexity Check .png
2018-12-27 16_12_37 Password Complexity Check .png (108.28 KiB) Viewed 3505 times
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Check if Input in Dialog is valid

Hello,
Check if the entered SQL instance name is allready used. I know where to look up in registry, but how can I read a registry value in dialog? Or is there a bettwer way than searching in registry?
This can be done through a registry search. For more information about this, please see the following articles:

- "Search Page"

- "Extended Search Properties"
Check if Windows Group Policy is configured that 'passwords must meet the complexity requirements'. If yes, check if the entered password is valid. Is something like that possible?
From what I know, the "Password must meet the complexity requirements" does not have a registry key assigned to it, so checking if that option is enabled can turn out to be pretty troublesome and unfortunately I am not aware of any way in which you can check that. In what regards the password check, I think that it can be done through a PowerShell script. From what I know, the things that you should look after are:

1- the password must contain at least one lower case character (e.g. a-z)

2- the password must contain at least one upper case character (e.g. A-Z)

3- the password must contain at least one numerical character (e.g. 0-9)

4- the password must contain at least one special character (e.g. !@#$%)

5- the password must be at least 8 characters long

Every dialog field has a property assigned to it that stores its value. This applies to the SQL password field from the SQL Dialog as well. The property that stores the password is:

Code: Select all

PASSWORD_PROP
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
This way, the $var variable will have the value of the password inserted by the user. For more information about this, you can have a look on the following articles:

- "Windows Installer Custom Actions"

- "Custom Actions Page"

- "Run Inline PowerShell Script"

- "How to set an installer property using custom actions"

Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
aho
Posts: 58
Joined: Thu Jul 21, 2016 4:38 pm

Re: Check if Input in Dialog is valid

Thanks for your reply!
It worked that way.
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Check if Input in Dialog is valid

You are always welcome.

I am glad I could help.

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

Return to “Building Installers”