I am currently packaging some SQL software where we would like the users to set their own password for the database it installs but we need to encrypt the input so it doesn't show in the logs.
-secureinput should work fine but the parameter is not recognised. Whats the issue?
$su_pwd = Show-ADTInstallationPrompt -RequestInput -Message 'Please enter a super user password' -ButtonRightText 'Submit' -SecureInput
The variable is then used for the password parameter for the app to use.
I was able to reproduce your issue. Bad news is this:
Error Record:
-------------
Message : A parameter cannot be found that matches parameter name 'SecureInput'.
How did this happen?
To automatically generate the Reference docs for PSADT, each function's header contains the information to create the docs. I'm guessing they generate and publish from the Develop branch and not the default Main branch of the PSADT code.
TL;DR: The -SecureInput parameter is coming to a future release of PSADT. It's not in V4.1.8.
Fair enough, suppose this isnt a PSADT query now but, does anyone have any examples where I can encrypt the user input so it should not show in the PSADT logs?
## sets password for database
$su_pwd = Show-ADTInstallationPrompt -RequestInput -Message 'Please enter a super user password' -ButtonRightText 'Submit'
## main install
Write-ADTLogEntry -Message "Installing $($adtsession.appvendor),$($adtsession.appname), $($adtsession.appversion)"
Start-ADTProcess -FilePath "$($adtSession.dirfiles)\postgresql-18.1-2-windows-x64.exe" `
-ArgumentList "--unattendedmodeui none --superpassword `"$su_pwd`" --mode unattended --enable-components server,stackbuilder,commandlinetools --install_runtimes 1"
Thats the full install command which works great but as I said, we dont really want the user input showing plain text in the logs.