Forum Discussion
dan_03_140075
Apr 22, 2014Nimbostratus
$user = $cred.Username;
$pass = $cred.GetNetworkCredential().Password;
$g_bigip = "dev1"
$ic = New-Object iControl.Interfaces
$ic.initialize($g_bigip, $user, $pass);
True
$ic.SystemSystemInfo.get_uptime();
4475412
$ic = $null
$ic.SystemSystemInfo.get_uptime();
You cannot call a method on a null-valued expression.
At line:1 char:1
+ $ic.SystemSystemInfo.get_uptime();
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
$cred = (get-credential)
$global:g_bigip = "dev1"
$global:success = Initialize-F5.iControl -HostName $global:g_bigip -credentials $cred;
(Get-F5.iControl).SystemSystemInfo.get_uptime();
4475650
$global:success = $null
(Get-F5.iControl).SystemSystemInfo.get_uptime();
4475663