Forum Discussion
Chris_Miles_169
Jun 06, 2012Nimbostratus
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.
- penghon_71315NimbostratusHi Chris,
- Chris_Miles_169NimbostratusThank you, that works perfectly.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects