Active IQ Unified Manager Discussions
Active IQ Unified Manager Discussions
Dear All
i would like to create WFA command that can create Local CISF user for ONTAP cluster mode.
i found an error as below.
The command:
param (
[parameter(Mandatory=$true, HelpMessage="Cluster (controller) IP or name.")]
[string]$Cluster,
[parameter(Mandatory=$true, HelpMessage="Name of the Storage Virtual Machine in which the CIFS share will be created.")]
[string]$Vserver,
[parameter(Mandatory=$true, HelpMessage="User Name.")]
[string]$User,
[parameter(Mandatory=$false, HelpMessage="Password.")]
[Alias("Password_Password")]
[string]$Password
)
# connect to cluster
Connect-WFACluster $Cluster
Get-WFALogger -Info -message $("Creating User share: " + $User + "Password: "+ $Password)
# Add User
New-NcCifsLocalUser -UserName $User -VserverContext $Vserver -Password $Password
i also attached my command in the attached file.
if you guys have any advice please light me.
Thank you in advanced.
Richy
Solved! See The Solution
Richy
You need to declare the parameter of type "Password" at workflow User-Inputs as well.
See the image.
Dear Sinhaa
finally got complete command.
param (
[parameter(Mandatory=$true, HelpMessage="Cluster (controller) IP or name.")] [string]$Cluster,
[parameter(Mandatory=$true, HelpMessage="Name of the Storage Virtual Machine in which the CIFS share will be created.")] [string]$Vserver,
[parameter(Mandatory=$true, HelpMessage="User Name.")] [string]$User,
[parameter(Mandatory=$false, HelpMessage="Password.")] [Alias("Password_Password")] [string]$Password
)
# connect to cluster
Connect-WFACluster $Cluster
Get-WFALogger -Info -message $("Creating User share: " + $User + "Password: "+ $Password)
# Add User
$PlainPass = $Password
$SecPass = $PlainPass | ConvertTo-SecureString -AsPlainText -Force
New-NcCifsLocalUser -UserName $User -VserverContext $Vserver -Password $SecPass
Thank you.
Brs,
Richy
Hi Richy,
Your command has passed but it hasn't done what you wanted it to do. It created the user account with incorrect password i.e. it sent the encrypted form of the password directly. The below line returns the provided password in SecureString format itself.
$SecPassword= Get-WfaInputPassword -EncryptedPassword $Password
This is not to be converted to secure string.
Right now I can't connect to VED, so will give you the right code.
sinhaa
Dear Richy,
The correct command code would be:
### Beging Code
param (
[parameter(Mandatory=$true, HelpMessage="Cluster (controller) IP or name.")]
[string]$Cluster,
[parameter(Mandatory=$true, HelpMessage="Name of the Storage Virtual Machine in which the CIFS share will be created.")]
[string]$Vserver,
[parameter(Mandatory=$true, HelpMessage="User Name.")]
[string]$User,
[parameter(Mandatory=$false, HelpMessage="Password.")]
[Alias("Password_Password")]
[string]$Password
)
# connect to cluster
Connect-WFACluster $Cluster
Get-WFALogger -Info -message $("Creating User share: " + $User + "Password: "+ $Password)
# Add User
$SecPassword= Get-WfaInputPassword -EncryptedPassword $Password
New-NcCifsLocalUser -UserName $User -VserverContext $Vserver -Password $SecPassword
## End Code
I just change the variable name $Password to $SecPassword. Due to some unknown reason its not overwriting the variable $Password. I'll debug this behavour now.
But the code design has some issues. You $Password is an optional paramter in command definition. So if somone doesn't provide it, your command will fail. So either you need to set it as Mandatory=$true or provide a default value for $Password if empty. I'll leave this choice to you.
sinhaa
Dear Richy,
The correct command code would be:
### Beging Code
param (
[parameter(Mandatory=$true, HelpMessage="Cluster (controller) IP or name.")]
[string]$Cluster,
[parameter(Mandatory=$true, HelpMessage="Name of the Storage Virtual Machine in which the CIFS share will be created.")]
[string]$Vserver,
[parameter(Mandatory=$true, HelpMessage="User Name.")]
[string]$User,
[parameter(Mandatory=$false, HelpMessage="Password.")]
[Alias("Password_Password")]
[string]$Password
)
# connect to cluster
Connect-WFACluster $Cluster
Get-WFALogger -Info -message $("Creating User share: " + $User + "Password: "+ $Password)
# Add User
$SecPassword= Get-WfaInputPassword -EncryptedPassword $Password
New-NcCifsLocalUser -UserName $User -VserverContext $Vserver -Password $SecPassword
## End Code
I just change the variable name $Password to $SecPassword. Due to some unknown reason its not overwriting the variable $Password. I'll debug this behavour now.
But the code design has some issues. You $Password is an optional paramter in command definition. So if somone doesn't provide it, your command will fail. So either you need to set it as Mandatory=$true or provide a default value for $Password if empty. I'll leave this choice to you.
sinhaa
Dear Sinhaa
thank you for your kindly helping & reply.
i will test out and let you know.
Brs,
Richy
Dear Sinhaa
i have tested on the command level seem the command working perfectly fine but when i add it into the workflow.
it doesn't work as it was.
so the error show as below:
i filled up the password but error reture as password empty have you experience this kind of error before ?
so if anyone found this issue before please light me.
i am running WFA v3.1
Best Regards,
Richy
Richy
You need to declare the parameter of type "Password" at workflow User-Inputs as well.
See the image.