Forum Discussion
That's a good one. I think it has to do with the default way that objects are pushed to the powershell command pipeline. When the first object is pushed, it sets up a table with columns,etc. When you enter the next object, it's looking for the previous columns (properties) from the last object and when it doesn't find them, it treats it like the object isn't part of the original result set. PowerShell does this so that you can display numerous objects one after another and it will print like they are all part of the same table.
You can get around this by explicitly passing the object through a formatter like format-table or format-list.
For your first example, give this a try:
Code
$IC = Get-F5.iControl
Retrieve a specific iRule DataGroupList
$MEMBERS = ($IC.LocalLBClass.Get_String_Class("Test_DG"))
$MEMBERS | Format-Table
Retrieve a list of all iRules
$IRULES = $IC.LocalLBRule.query_all_rules()
$IRULES | Format-Table
I've been writing PowerShell scripts for almost 10 years and since 99.99% of the time I parse the returned objects, I haven't come across this one. Next time we run into each other, I'll buy you a drink for finding out something I didn't know about PowerShell. If you by chance are at one of our Agility events this year, look me up!
Hope this helps...
-Joe