Forum Discussion
Are you using Rest or the PS Snapin?
/Patrik
- or6680Nimbostratus
Yes Dear, I succeed only to add string but i need to add string=value
Been a while since I've been called dear by a stranger on a technical internet forum. Gives me a warm and fuzzy feeling... :)
You did not answer my question though. Are you using Rest or the iControl PS Snapin by Joe Pruitt? There's also the module by Joel Newton.
/Patrik
- or6680Nimbostratus
I use the PS Snapin
OK, please hold, I'll see what I can do.
/Patrik
- or6680Nimbostratus
Hey,
Thank you so much. This is what i suceed to do so far:
Initialize- -Hostname 172.16.100.227 -Username admin -Password admin $StringClassA = (Get-;;) ); $ValuesAofA = (Get-($StringClassA); Write-Host "Data Group DNS-DB" Write-Host "IP's:" $StringClassA[0].members Write-Host "Countris" $ValuesAofA[0] $Class = (Get- $StringClass = New-Object -typename iControl.LocalLBClassStringClass $StringClass.name = "Test" $StringClass.members = (".idscs", ".bsmds") $Class.add_string_class_member((,$StringClass)) $ValueClass = New-Object -typename iControl.LocalLBClassValueClass $ValueClass.name = "Test" $ValueClass.members = ("2", "1") $Class.add_Value_class_member((,$ValueClass)) $Class.get_value_class_list()
I only succed to add string. Thank you.
Yeah, it's a bit tricky. First of all the iControl API calls it class while the Web UI calls it data-group list. Then there is two separate methods to add a new member with a value:
- One for adding the member
- One for adding the value to the member
Here's a working concept script to add a member to an existing data group list of type string using the iControl Snapin:
Allow TLS1.2 if you have forced that on the management interface (and you should) [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Initialize Snapin if ( (Get-PSSnapin | Where-Object { $_.Name -eq "iControlSnapIn"}) -eq $null ){ Add-PSSnapIn iControlSnapIn } $User = 'user' $Password = 'password' $Partition = "Common" $BigIP = "1.1.1.1" Connect to the BigIP $Success = Initialize-F5.iControl -HostName $BigIP -Username $User -Password $Password Get an iControl Handle $F5 = Get-F5.iControl $f5partitions = $f5.ManagementPartition $f5partitions.set_active_partition($Partition) Create a new String class (data group list of type string) $entry = New-Object -TypeName iControl.LocalLBClassStringClass Which data group list you want to add a member to $entry.name = "Mydatagrouplist" What is the member name? $entry.members = @(,"key") What is the value? $value = @("value") First create the key $f5.LocalLBClass.add_string_class_member(@($entry)) Then set the value $f5.LocalLBClass.set_string_class_member_data_value(@($entry), @($value));
Hope it helps.
/Patrik