Answered my own question but definitely with a head scratch. Modified code below; the only difference in the code is that I am reading the 3 parameters (controller IP/name, login and password) into string variables then using the resulting stored strings in my calls and everything works no problem.
Proxy ontap = new Proxy();
string IP = textBox1.Text.ToString();
string login = textBox2.Text.ToString();
string password = textBox3.Text.ToString();
SecureString secpwd = new SecureString();
foreach (char c in password)
{
secpwd.AppendChar(c);
}
PSCredential Credential = new PSCredential(login, secpwd);
try
{
var controller = ontap.NaController.Connect(IP, null, Credential, commandSwitches:
NaController.ConnectAttributes.HTTPS |
NaController.ConnectAttributes.Transient).First();
MessageBox.Show("Success", "NetApp Proxy Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message, "NetApp Proxy Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
Thanks,
Rob