Forum Discussion
May 09, 2015
Hi wallst
I've fiddled quite a bit with powershell and I must say I've never seen this before. The object is actually not Null, it contains data, but it is not shown for some reason. The only explanation I can think of is that it's a bug.
Check this out:
$user = 'user'
$pass = 'password'
if ( (Get-PSSnapin | Where-Object { $_.Name -eq "iControlSnapIn"}) -eq $null ){
Add-PSSnapIn iControlSnapIn
}
$success = Initialize-F5.iControl -HostName 10.0.0.1 -Username $user -Password $pass;
$f5 = Get-F5.iControl
Set the partition (good practice)
$f5partitions = $f5.ManagementPartition
$f5partitions.set_active_partition("Common")
Retrieve a specific iRule DataGroupList
$members = $f5.LocalLBClass.Get_String_Class("images")
Retrieve a list of all iRules
$irules = $f5.LocalLBRule.query_all_rules()
$members
$irules.Count
For($x=0;$x -lt $IRULES.Count;$x++){
if($irules[$x].rule_name -eq "/Common/_sys_auth_ssl_crldp") {
"match"
}
}
That would give me the following output in my case:
name members
---- -------
images {.bmp, .gif, .jpg}
39
match
As you can see the data is there, but not shown. If I post execution enter one of the variables I get the data:
rule_name rule_definition
--------- ---------------
/Common/_sys_auth_ssl_cc_ldap when CLIENT_ACCEPTED {...
/Common/_sys_auth_ssl_ocsp when CLIENT_ACCEPTED {...
/Common/_sys_auth_ssl_crldp when CLIENT_ACCEPTED {...
/Common/_sys_auth_krbdelegate when HTTP_REQUEST {...
/Common/_sys_https_redirect when HTTP_REQUEST {...
...
If I have some more time I'll go through it a bit more, but I hope that helps at least a bit.
Btw, setting the partition is good practice. You can get unpleasant side effects otherwise. 🙂
/Patrik