Passing credential to New-Object iControl.Interfaces
Hello, big fan of powershell and icontrol. The F5 DevCentral has been awesome to get up and running. I have been using $cred = (get-credential) Initialize-F5.iControl -HostName $g_bigip -credentials $cred;
To do my authentication and init. Problem is I dont know how to disconnect that init? I found this topic 9https://devcentral.f5.com/questions/how-to-disconnect-icontrol-session) and asked my question there too. Its old so maybe things have changed. From there I was able to use $ic = New-Object iControl.Interfaces $ic.initialize("hostname", "username", "password"); But dont know if get-credentials and variable can be used here? I have tried $cred = (get-credential) $uid=$cred.username $pw=$cred.password $bigip="lsg-cag-uat1" $ic.initialize($bigip,$uid,$pw) and $ic.initialize("$bigip","$uid","$pw") getting error in both cases You cannot call a method on a null-valued expression. At line:1 char:1 + $ic.initialize("$bigip","$uid","$pw") + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
Thanks