A great question came in yesterday about how to use the new –Credential parameter that was implemented in v2.5 Toolkit.
Question: What if someone wants to use the script the old way, and programmatically send the password?
Create a new credential variable and require a prompt for credentials entry via the traditional dialog box.
$Creds = Get-Credential
Now $Creds can be viewed with $Creds.Username and $Creds.Password. The Password is in the form of a System.Security.SecureString.
Then when creating a connection to the FlashArray you can pass the $Creds into the cmdlet.
$MySession = Get-PfaApiToken -FlashArray MyArray -Credential $Creds | Connect-PfaController
Create a new PSCredential object that can then be passed to the Get-PfaApiToken programmatically.
$Pwd = ConvertTo-SecureString "pureuser" -AsPlainText -Force $Creds = New-Object System.Management.Automation.PSCredential ("pureuser", $pwd) $MySession = Get-PfaApiToken -FlashArray MyArray -Credential $Creds | Connect-PfaController
Have a $Credentials day!