Dang, that's what I get for assuming that a cmdlet will work according to its documentation! 🙂
It looks like there's a discrepancy between what the cmdlet itself accepts for the NameServers parameter and what the "name-servers" parameter in ZAPI accepts. From the de-compiled Set-NcNetDns cmdlet:
[Parameter(HelpMessage = "Addresses of name servers such as '123.123.123.123'.", Position = 1, ValueFromPipelineByPropertyName = true)]
[AllowNull]
[AllowEmptyCollection]
[Alias(new string[] {"Servers"})]
public string[] NameServers { get; set; }
And the ZAPI:
<?xml version="1.0" encoding="UTF-8"?>
<netapp xmlns="http://www.netapp.com/filer/admin" version="1.160">
<net-dns-modify>
<attempts></attempts>
<dns-state></dns-state>
<domains></domains>
<is-tld-query-enabled></is-tld-query-enabled>
<name-servers>
<ip-address></ip-address>
</name-servers>
<require-packet-query-match></require-packet-query-match>
<require-source-address-match></require-source-address-match>
<skip-config-validation></skip-config-validation>
<timeout></timeout>
</net-dns-modify>
</netapp>
PS C:\users\donny.lang\desktop> $Request = @"
>>
>> <net-dns-modify>
>> <name-servers>
>> <ip-address>""</ip-address>
>> </name-servers>
>> </net-dns-modify>
>> "
PS C:\users\donny.lang\desktop> Invoke-NcSystemApi -Request $Request -VserverContext lab-svm-01
Invoke-NcSystemApi : Invalid value specified for "name-servers" element within "net-dns-modify": """".
At line:1 char:1
+ Invoke-NcSystemApi -Request $Request -VserverContext lab-svm-01
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (10.250.63.175:NcController) [Invoke-NcSystemApi], EINVALIDINPUTERROR
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.System.InvokeNcSystemApi
I wonder if it worked in an older version of the API and was removed/changed for some reason.