Forum Discussion

Chris_Miles_169's avatar
Chris_Miles_169
Icon for Nimbostratus rankNimbostratus
Jun 06, 2012

Error calling add_a through Powershell

I have a sample script to all a DNS entry to our F5 box via the Powershell interface to iControl.

 

 

I have tried a number of options and keep running into errors, the closest I believe is the one below, but I cannot find a way around it.

 

 

Please help.

 

 

Script is:

 

Add-PSSnapIn iControlSnapIn

 

Initialize-F5.iControl -HostName ???? -Username ???? -Password ????

 

$ic = Get-F5.iControl

 

$zone = New-Object -TypeName iControl.ManagementViewZone

 

$zone.view_name = "external"

 

$zone.zone_name = "cmltd.net.au."

 

$arec = New-Object -TypeName iControl.ManagementARecord

 

$arec.domain_name = "clmbox001."

 

$arec.ip_address = "1.2.3.4"

 

$arec.ttl = "300"

 

$ic.ManagementResourceRecord.add_a($zone,$arec,"1")

 

 

Error is:

 

Exception calling "add_a" with "3" argument(s): "Exception caught in Management ::urn:iControl:Management/ResourceRecord::add_a()

 

Exception: Common::OperationFailed

 

primary_error_code : 18154507 (0x0115040B)

 

secondary_error_code : 0

 

error_string : 0115040b:3: No match found for zone during update. " At line:1 char:35

 

+ $ic.ManagementResourceRecord.add_a <<<< ($zone,$arec,"1")

 

+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException

 

+ FullyQualifiedErrorId : DotNetMethodException

 

 

 

The data passed is correct, but I don't if I have the correct format.

 

However, I have been able t retrieve data using the above structure for $zone using the command:

 

$dnsList = $ic.ManagementResourceRecord.get_rrs_detailed((,$zone))

 

so as far as i can tell, the $zone definition is correct.