Unable to Pass a Credential Object to -MasterKey Parameter
jkdba opened this issue · comments
John Klann commented
Supposed to be able to pass a cred, or secure string to the -MasterKey
parameter however for the time being only secure strings are working.
The use of the credential objects Password property works as a workaround for this issue. From the example below -MasterKey $KeeCred.**Password**
.
Example usage:
# Create a Credential Object Variable
# this will prompt you for the master password for a scriptable usage please read the MS documentation # on the Get-Credential function
$KeeCred = Get-Credential -Message 'MasterKey Password:' -UserName 'KeePass'
# make a call with this Credential using the secure string password
Get-KeePassEntry -AsPlainText -DatabaseProfileName TestDB -MasterKey $KeeCred.Password
Solution:
Update dynamic parameter loading function and update type validation on the -MasterKey parameter to support both creds and secure strings.
The underlying code already supports it.