Microsoft Virtualization Discussions

Error trying to add credential on powershell

Segun
191 Views

Please see attached picture, it pops the error message whenver we run "Add-Credential  ip-address -cred CredInfo" and supplying password. 

 

Please help any useful idea/info. thank you

 

Segun_0-1730499461170.png

 

3 REPLIES 3

Sanaman
88 Views

It works for me

Sanaman_1-1730687648388.png

You can use this way to save the encrypted password (alternative way)

 

Powershell Store Encrypted Password for auto login
$credential = Get-Credential
$credential.password |ConvertFrom-SecureString |set-Content C:\Users\<user_name>\encrypted_password.txt
$encrypted = Get-Content C:\Users\<user_name>\encrypted_password.txt | ConvertTo-SecureString
$dom_user = "domain\user_name"
$credential = New-Object System.Management.Automation.PsCredential($dom_user, $encrypted)

Add-NcCredential -Controller <controller> -credential $credential

Segun
54 Views

Thank you Sanaman,

 

I tried your recommended script and still getting error shown in below attachment.

 

Sanaman
32 Views

What version is your PSTK?

Scripts> Import-Module "C:\Users\<User>\Documents\PowerShell\Modules\netapp_ontap\NetApp.ONTAP"


PS C:\Users\user\Scripts> get-natoolkitversion

Major Minor Build Revision
----- ----- ----- --------
9 15 1 2410

Public