Subscribe
Accepted Solution

Using password userinput in command fails

Hi,

 

I try to use the new password userinput in a workflow command.

I pass the userinput as a parameter to the command but when I want to use it, the command fails. Here is an excerpt from the command, showing the relevant code:

 

   ...

   [parameter(Mandatory=$true, HelpMessage="Password of the user with privileges to add the SVM to the ADS domain.")]

   [string]$DomainAdmPasswd,

   ...

 

   $pwd = Get-WfaInputPassword -EncryptedPassword $DomainAdmPasswd -ErrorAction Stop

 

   Add-NcCifsServer -Name $CifsServerName -Domain $Domain -OrganizationalUnit $OrganizationalUnit -AdminUsername $DomainAdmUser -AdminPassword $pwd -Force -VserverContext

   $VserverName -ErrorAction Stop

 

This results in the following error: Failed to create the Active Directory machine account "XXX". Reason: LDAP Error: The supplied credential is invalid.

 

Can someone help me with this?

 

Thanks in advance

Walter

 

Re: Using password userinput in command fails

Hi Walter,

 

The command which needs the password should have the parameter defined as a 'Password'. The way to do this is to have an alias for the parameter in the command definition.

This is how you would define it in your command definition:

 

 [parameter(Mandatory=$true, HelpMessage="Password of the user with privileges to add the SVM to the ADS domain.")]

 [Alias("Pwd_Password")]

 [string]$DomainAdmPasswd

 

When you use 'Discover Parameters', if the command parameter type is discovered as a 'Password', then you should be fine.

 

Also, the return parameter from the Get-WfaInputPassword is a SecureString type. You need to convert this to plain String before using it as an input parameter to AdminCredential in the cmdlet. Alternatively, you can use the variant that accepts the PSCredential as an input.

 

You can use the 'Create and Configure Virtual Storage Machine' command as a reference. 

Hope this helps.

Re: Using password userinput in command fails

Hi Rajathr,

 

with the command 'Create and Configure Virtual Storage Machine' as a reference it works.

 

Thanks for your help!

 

Best Regards

Walter