Hi,
For secure connection into PowerShell script I use the following procedure:
1. I run the following commands manually :
# $PASSWORD="password"
# $KEY=ConvertTo-SecureString "$PASSWORD" -AsPlainText -Force | ConvertFrom-SecureString
#$KEY=01000000d08c9ddf0115d1118c7a00c04fc297eb010000001df078edba0b8644a18c9c7a0921f1e00000000002000000000003660000c000000010000000664e1f7379031a569622b57d4b044f200000000004800000a0000000100000007528676d35e19049608e5bf2026d2f3d1800000038ef3efcefe8ac0119b4bc1070f41cb1bd680ba14e557a9f140000008a916156eb775211d68e4c9ba32aa07d64bcf9ad
2. After that i insert the KEY varibale into my script:
$USER="root"
$KEY="01000000d08c9ddf0115d1118c7a00c04fc297eb010000001df078edba0b8644a18c9c7a0921f1e00000000002000000000003660000c000000010000000664e1f7379031a569622b57d4b044f200000000004800000a0000000100000007528676d35e19049608e5bf2026d2f3d1800000038ef3efcefe8ac0119b4bc1070f41cb1bd680ba14e557a9f140000008a916156eb775211d68e4c9ba32aa07d64bcf9ad"
$SECUREPASSWORD = "$KEY" | ConvertTo-SecureString
$IP_CONTROLER = "192.168.0.10"
#
# Secure Connexion to Controller
#
$CREDENTIAL=New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "$USER",$SECUREPASSWORD
Connect-NaController -credential $CREDENTIAL $IP_CONTROLER | out-null