(Get-F5.iControl).LocalLBVirtualServer.add_rule

I want to use (Get-F5.iControl).LocalLBVirtualServer.add_rule to add a irule to a virtual server.

The method signature is:

{System.Void add_rule(String[] virtual_servers, LocalLBVirtualServerVirtualServerRule[][] rules)}

The problem is the second parameter. How do I put my rule into a 2 dimensional array of type LocalLBVirtualServerVirtualServerRule and pass it to the method?

To add to that, I have already added the rule to the F5 using:

(Get-F5.iControl).LocalLBRule.Create($ruleDef)

Is there any method to just add this rule to a virtual server by rulename?

Here’s a tech tip I wrote a while back covering iRules with PowerShell. This should give you all the info you need.

-Joe