Custom Action to Verify Password - Advanced Installer Community

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!

invalidptr
Posts: 79
Joined: Thu Nov 18, 2010 7:10 pm

Custom Action to Verify Password

I'm trying to install the service as an administrator. I've followed the guidelines documented here and here. On the later link for "Check If User Exists", it's mentioned, "This custom action does not verify the user account password in order to maintain password security.". Is that true? Seems like a bummer to get to the installation process and fail in the middle of it because the user entered an incorrect password than to verify it up front. Is there not a way to verify the password?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Custom Action to Verify Password

Hello,

Unfortunately there is no predefined functionality for this in Advanced Installer. You can try to verify the user account password from within your own custom action.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kkrzyzak
Posts: 47
Joined: Wed Oct 13, 2010 2:10 pm

Re: Custom Action to Verify Password

1.Create property in install parameters tab eg: PASS_IS_GOOD with default value set 0
2.Create passCheck.vbs

Code: Select all

IF Len(Session.Property("PASS_FIELD"))<2  Then 
	Session.Property("PASS_IS_GOOD") = "0"
Else
	Session.Property("PASS_IS_GOOD") = "1"
End If
3.Create Action that runs passCheck.vbs
4.Create Action VBScript inline [showUserEnterValidPass]

Code: Select all

MsgBox "Some info that pass is not good", vbOKOnly + vbSystemModal + vbExclamation, "Warrning"
5. In Published events:
DoAction checkPass
DoAction inline showUserEnterValidPass but in condition you must enter PASS_IS_GOOD = 0

I hope this was helpful.

Best,
Karol.
invalidptr
Posts: 79
Joined: Thu Nov 18, 2010 7:10 pm

Re: Custom Action to Verify Password

kkrzyzak, I'm looking to verify it's the same password Window's has for the given user name. Not verify it's a certain length.
invalidptr
Posts: 79
Joined: Thu Nov 18, 2010 7:10 pm

Re: Custom Action to Verify Password

I ended up finding some VBscript that does the trick. YMMV

Code: Select all

Function ValidatePassword(user, password)
	Dim network, fileSystemObject, shell, cmdLine
	Dim computerName, pathToPSExec, result

	Set network = CreateObject("WScript.Network")
	computerName = network.ComputerName
	
	Set fileSystemObject = CreateObject("Scripting.FileSystemObject")
	Set shell = CreateObject("WScript.Shell")

    pathToPSExec = fileSystemObject.GetFile("psexec.exe").ShortPath
    cmdLine = pathToPSExec & " -accepteula -e -u " & user & " -p " & password & " \\" & computerName & " cmd /c"
    result = shell.Run(cmdLine, 0, True)
    If result = 1326 Then
        ValidatePassword = False
    Else
        ValidatePassword = True
    End If
End Function 

ValidatePassword ".\administrator", "123456"

Return to “Common Problems”